You've already forked Curso-lenguaje-python
Restructure content and add notes from HolaMundo
Signed-off-by: Manuel Vergara <manuel@vergaracarmona.es>
This commit is contained in:
29
HolaMundo/08_funciones.py
Normal file
29
HolaMundo/08_funciones.py
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
# Parámetros por defecto
|
||||
def hola(nombre="Mun", apellido=""):
|
||||
print("Hola mundo")
|
||||
print(f"Bienvenido {nombre} {apellido}!")
|
||||
|
||||
|
||||
# Argumento indicando el parámetro concreto
|
||||
hola(apellido="García")
|
||||
|
||||
print("")
|
||||
|
||||
hola("Mariano", "Bermudez")
|
||||
|
||||
hola()
|
||||
|
||||
# Parámetro comodín (iterable)
|
||||
# para añadir un número indeterminado de argumentos.
|
||||
# xargs
|
||||
|
||||
|
||||
def suma(*numeros):
|
||||
resultado = 0
|
||||
for numero in numeros:
|
||||
resultado += numero
|
||||
return resultado
|
||||
|
||||
|
||||
print(suma(3, 6, 2, 4, 65, 23, 4, 100))
|
||||
Reference in New Issue
Block a user