-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
32 lines (30 loc) · 998 Bytes
/
app.py
File metadata and controls
32 lines (30 loc) · 998 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
lista = []
while True:
print('(A)dicinar | (R)emover | (L)istar')
comando = input('Digite oque deseja: ')
if comando.lower() == 'a':
item = input('Digite o nome do Item: ')
if item != '':
lista.append(item)
print('item adicionado a sua lista.')
else:
print('Você não digitou nome do item!')
elif comando.lower() == 'r':
indice = input('Qual indice do Item que deseja Remover: ')
try:
if int(indice) < len(lista):
lista.pop(int(indice))
print('Item removido com Sucesso.')
else:
print('indice inexistente.')
except:
print('Digite o indice corretamente.')
elif comando.lower() == 'l':
if len(lista) > 0:
for i, item in enumerate(lista):
print(i,item)
else:
print('Nenhum item encontrado!')
else:
print('opção incorreta.')
continue