-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodigo_python.py
More file actions
132 lines (98 loc) · 3.24 KB
/
codigo_python.py
File metadata and controls
132 lines (98 loc) · 3.24 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#A ideia do algoritmo, é simular o cadastro de um cliente/usuario
#APF, verificar valores duplicados quando for inserir, tratamento de erro
def criar_nome():
nome = []
nome_ = input('Digite seu nome: ')
copia_nome = nome_
nome_ = nome_.split()
for partes_nome in nome_:
if partes_nome.isalpha() == True:
boleana = True
else:
boleana = False
break
if boleana == True:
nome.append(copia_nome)
else:
print('\u001b[31m'+'Nome incorreto, digite novamente!'+'\u001b[37m')
temp = criar_nome()
temp = temp[0]
nome.append(temp)
return nome
def criar_cpf():
cpf = []
cpf_ = input('Digite seu CPF(somente números/sem espaços): ')
if cpf_.isnumeric() == True:
boleana = True
else:
boleana = False
if boleana == True:
cpf.append(cpf_)
else:
print('\u001b[31m'+'CPF incorreto, digite novamente!'+'\u001b[37m')
temp = criar_cpf()
temp = temp[0]
cpf.append(temp)
return cpf
def criar_email():
email = []
email_ = input('Digite seu email: ')
if email_.find('@') != -1:
boleana = True
else:
boleana = False
if boleana == True:
email.append(email_)
else:
print('\u001b[31m'+'Email incorreto, digite novamente!'+'\u001b[37m')
temp = criar_email()
temp = temp[0]
email.append(temp)
return email
def criar_telefone():
telefone = []
telefone_ = input('Digite seu Telefone(somente números/sem espaços): ')
if telefone_.isnumeric() == True:
boleana = True
else:
boleana = False
if boleana == True:
telefone.append(telefone_)
else:
print('\u001b[31m'+'Telefone incorreto, digite novamente!'+'\u001b[37m')
temp = criar_telefone()
temp = temp[0]
telefone.append(temp)
return telefone
def cadastrar():
print('\n___Cadastro__de__Cliente___')
nome = criar_nome()
cpf = criar_cpf()
email = criar_email()
telefone = criar_telefone()
return nome,cpf,email,telefone
def atualizar():
print('\n___Atualização__de__Cadastro___')
print('Opções de atualização:\n1 - Nome;\n2 - CPF;\n3 - Email;\n4 - Telefone;\n')
opcao = input('Digite a opção desejada: ')
if opcao == '1':
antigo_nome = input('Digite o antigo nome: ')
novo_nome = input('Digite o novo nome: ')
dados_ = novo_nome,antigo_nome,'nome'
elif opcao == '2':
antigo_cpf = input('Digite o antigo CPF: ')
novo_cpf = input('Digite o novo CPF: ')
dados_ = novo_cpf,antigo_cpf,'cpf'
elif opcao == '3':
antigo_email = input('Digite o antigo email: ')
novo_email = input('Digite o novo email: ')
dados_ = novo_email,antigo_email,'email'
elif opcao == '4':
antigo_tel = input('Digite o antigo telefone: ')
novo_tel = input('Digite o novo telefone: ')
dados_ = novo_tel,antigo_tel,'telefone'
return dados_
def deletar():
print('\n___Apagar__registro__de__usuário___')
cpf_usuario = input('Digite o CPF do usuário que deseja apagar: ')
return cpf_usuario