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:
32
python-total/dia_05/02_funciones.py
Normal file
32
python-total/dia_05/02_funciones.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
funciones
|
||||
"""
|
||||
|
||||
# Simpple
|
||||
|
||||
def suma5(nombre):
|
||||
"""
|
||||
Esto es una función para decir hola
|
||||
"""
|
||||
print("Hola! " + nombre)
|
||||
|
||||
name = input("Dime tu nombre: ")
|
||||
|
||||
for i in range(5):
|
||||
suma5(name)
|
||||
|
||||
# return
|
||||
def sumar(num1,num2):
|
||||
total = num1 + num2
|
||||
return total
|
||||
|
||||
resultado = sumar(10,5)
|
||||
|
||||
print(resultado)
|
||||
|
||||
# Ejercicio de codificación
|
||||
def invertir_palabra(palabra):
|
||||
reverso = palabra[::-1]
|
||||
return reverso
|
||||
|
||||
print(invertir_palabra("Python").upper())
|
||||
Reference in New Issue
Block a user