-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathandre_desafio1.py
executable file
·51 lines (46 loc) · 1.68 KB
/
andre_desafio1.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
48
49
50
51
print("Cadastro Identidade")
name = input("Digite seu nome:\n").upper()
age = input("Digite sua idade:\n").upper()
address = input("Digite seu endereço:\n").upper()
father = input("Nome do pai:\n").upper()
mother = input("Nome da mãe:\n").upper()
profession = input("Qual sua profissão:\n").upper()
## Para testes:
# name = "Teotônio Parrudo Garrido Golias Galante Lacerda Pedroso Peixoto Cardoso Carvalho Cabral Cavalcante".upper()
# age = "100000"
# address = "Rua dos Bobos nº 0".upper()
# father = "Mr Catra (Wagner Domingues Costa)".upper()
# mother = "Leontina Albino".upper()
# profession = "O Gigante".upper()
# Define o tamanho do box que será feito:
box = 40
# Precisando de uma linha extra?
line_break = ("","")
# Define os textos e campos que será mostrado:
fields = [line_break,
("CARTEIRA DE IDENTIDADE".center(box-3,"_"), ""),
line_break,
("NOME:",name),
("IDADE:",age),
line_break,
("ENDEREÇO:",address),
line_break,
("FILIAÇÃO:",""),
("-",father),
("-",mother),
line_break,
("PROFISSÃO:",profession),
line_break,
line_break,
line_break,
("JUNDIAI/SP".center(box-3),""),
line_break]
# Desenha a caixa (box) com os campos (fields) dentro, dimensionados):
def draw_box(fields, box):
print("╔".ljust(box,"═") + "╗")
for txt,variable in fields:
print("║" +
" {} {}".format(txt, variable[:(box - len(txt) - 3)]).ljust(len(txt), " ") +
"║".rjust(box - 2 - len(txt) - len(variable[:(box - len(txt) - 3)])," "))
print("╚".ljust(box,"═") + "╝")
draw_box(fields,box)