-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path12.functions_theory.py
More file actions
78 lines (57 loc) · 1.39 KB
/
Copy path12.functions_theory.py
File metadata and controls
78 lines (57 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# EXEMPLOS DE APLICAÇÃO
# METHOD SOLID - Single Responsability PRINCIPLE
def funcao_teste( a, b, c):
""" This function do something with a, b, c
Use this functionto do this a + b + c
:param a: int
:param b: int
:param c: int
obs: This standard is falling in desuse because the "type hint"
https://docs.python.org/3/library/typing.html
"""
# Type Hint
def funcao_type_hint( a: int, b: int, c: int) -> int:
resultado = a + b + c
return resultado
#print(help(funcao_teste))
#output
"""
funcao_teste(a, b, c)
This function do something with a, b, c
Use this functionto do this a + b + c
:param a: int
:param b: int
:param c: int
obs: This standard is falling in desuse because the "type hint"
https://docs.python.org/3/library/typing.html
"""
print("*****************")
#print(help(funcao_type_hint))
#Output
"""
funcao_type_hint(a: int, b: int, c: int) -> int
# Type Hint
"""
# PASSAGE OF ARGUMENTS
def soma( n1, n2):
"""
Calculate the sum of "a" and "b"
"""
return n1+n2
test1 = [
{"n1": 90, "n2": 20},
{"n1": 65, "n2": 23},
{"n1": 65, "n2": 24},
{"n1": 905, "n2": 2}
]
test2 = [
(1,2),
(5,6),
(9,54)
]
print("************")
for i in test1:
print(soma(**i))#Desempacota dicionários
print("************")
for y in test2:
print(soma(*y))#Desempacota tuplas