Skip to content

Commit 435bc54

Browse files
Tadeo WotoszynTadeo Wotoszyn
authored andcommitted
feat: leccion de type hints agregada
1 parent 55e1bb4 commit 435bc54

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

userbackend/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

userbackend/types.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""
2+
def get_full_name(first_name: str, last_name: str) -> str:
3+
full_name = first_name.title() + " " + last_name.title()
4+
return full_name
5+
6+
7+
8+
print(get_full_name("john", "doe"))
9+
10+
11+
12+
13+
Esto es una funcion tipada, sirve para tanto usar el autocomplete de el ide
14+
y para mantener una estructura solida y evitar errores con el tipado dinamico de py.
15+
Aunque tipemos una variable, python sigue siendo tipado dinamico. No podemos obligar a lo contrario.
16+
"""
17+
def get_all_names(listOfNames: list[str]):
18+
19+
for name in listOfNames:
20+
print(f"hello {name}")
21+
22+
names = ["pedro", "juan", "juanito"]
23+
24+
get_all_names(names)

0 commit comments

Comments
 (0)