Académique Documents
Professionnel Documents
Culture Documents
FACULTAD DE INGENIERIA
PROGRAMACION DE
COMPUTADORES
1
CONTENIDO
print sumar(3, 2)
Las funciones en Python también podrían pasar varios valores que retornar en un return. La siguiente
función devuelve dos valores x e y multiplicados por 2.
def f(x, y):
return x * 2, y * 2
a, b = f(1, 2)
Observe que al llamar la función, como esta devuelve dos valores, el llamado de la función, se deberá
asignar a dos variables.
EJERCICIO: DEFINIENDO FUNCIONES
Escriba un programa que calcule y muestre el área de un triángulo, utilizando una función.