Created
January 22, 2018 11:10
-
-
Save vmesel/676253e6aadfd7a84e5696f51b63e0de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
precos = { | |
100: (1.20, "Cachorro Quente"), | |
101: (1.30, "Bauru Simples"), | |
102: (1.50, "Bauru com ovo"), | |
103: (1.20, "Hambúrguer"), | |
104: (1.30, "Cheeseburguer"), | |
105: (1.00, "Refrigerante") | |
} | |
pedido = [] | |
final_pedido = [] | |
while True: | |
for k, v in precos.items(): | |
print(str(k) + "-->" + v[1]) | |
cod = input("Digite o código do produto desejado, ou aperte 0 para fechar o pedido.\n") | |
if cod in ["0", ""]: | |
break | |
elif int(cod) not in precos.keys(): | |
print("ERRO: Escreva um código de um produto que exista!") | |
else: | |
preco = precos[int(cod)][0] | |
qt = input("Digite a quantidade do produto desejado\n") | |
pedido.append((cod, qt, preco)) | |
for x in pedido: | |
final_pedido.append((precos[int(x[0])][1], int(x[1]) * x[2])) | |
print("Pedido final") | |
print("\n".join(["{} -- R$ {}".format(x[0], x[1]) for x in final_pedido])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment