You've already forked Curso-lenguaje-python
Update Python Ofensivo
This commit is contained in:
31
python-ofensivo/00_ejercicios/06_decoradores04.py
Normal file
31
python-ofensivo/00_ejercicios/06_decoradores04.py
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
*args: argumentos posicionales
|
||||
|
||||
**kwargs: argumentos nombrados
|
||||
"""
|
||||
|
||||
# EJEMPLO DE *args
|
||||
|
||||
|
||||
def suma(*args):
|
||||
|
||||
return sum(args)
|
||||
|
||||
|
||||
# EJEMPLO DE **kwargs
|
||||
|
||||
def presentacion(**kwargs):
|
||||
|
||||
print("[+] Mis datos:")
|
||||
for key, value in kwargs.items():
|
||||
|
||||
print(f"\t- {key}: {value}")
|
||||
|
||||
|
||||
presentacion(
|
||||
nombre="Juan",
|
||||
edad=20,
|
||||
ciudad="Medellín",
|
||||
profesion="Lammer"
|
||||
)
|
||||
Reference in New Issue
Block a user