-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuncoes.py
47 lines (38 loc) · 883 Bytes
/
funcoes.py
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
def maior(num1, num2):
if num1 > num2:
res = num1
#return num1
elif num2 >= num1:
res = num2
#return num2
print(res)
def maior2(num1, num2):
return max([num1, num2])
def area_triangulo(base, altura):
area = (base * altura)/2
return area
def mydivmod(dividendo, divisor):
resto = dividendo % divisor
divisao = dividendo // divisor
return divisao, resto
def indices(lista, valor):
res = []
for pos, item in enumerate(lista):
if item == valor:
res.append(pos)
return res
def fatorial(num=3):
fat = 1
#cont = 1
#while cont <= num:
# fat *= cont
# cont+=1
for cont in range(1, num+1):
fat *= cont
return fat
### MAIN ###
maior(10, 10)
resultado = area_triangulo(4, 4)
print(resultado)
print(mydivmod(10, 2))
print(fatorial())