-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path11_funcoes.py
More file actions
46 lines (40 loc) · 917 Bytes
/
11_funcoes.py
File metadata and controls
46 lines (40 loc) · 917 Bytes
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
# Exemplo 8:
# Faca uma funcao que verifica se um numero eh par e retorna True, caso positivo, e False caso contrario
def par(x):
if(x%2==0):
return True
else:
return False
# Exercicio 17:
# Construa uma funcao que desenhe um retangulo usando '*'.
# Esta funcao deve receber dois parametros, linhas e colunas.
def ret(linha,col):
for i in range(linha):
for j in range(col):
print('*',end='')
print()
# Exercicio 18:
# Faca uma funcao que retorne o reverso de um numero inteiro informado. Por exemplo: 127 -> 721.
def reverso(n):
i = 0
while(n != 0):
resto = n % 10
n = n // 10
print(resto,end='')
n = 8765
reverso(n)
# Exercicio 19:
# Faça uma funcao, que verifica se um caractere eh vogal.
def vogal(c):
if(c == 'a'):
return True
elif(c == 'e'):
return True
elif(c == 'i'):
return True
elif(c == 'o'):
return True
elif(c == 'o'):
return True
else:
return False