1. Modular Programming¶

1.1. Transaction File Transactions.txt¶

1.2. Sale of Salgados¶
def save_transaction(price, credit_card, description):
file = open('transactions.txt',"a")
file.write("%16s%07d%16s\n" %(credit_card,price*100,description))
file.close()
articles = ["Sfiha","Cocina","Pastel","Pan de queso"]
prices = [1.50,2.20,1.80,1.20]
running = True
while running:
option = 1
for choose in articles:
print(str(option) + "." + choose)
option += 1
print(str(option) + ".Finalizar")
choose = int(input("Escoja una opción: "))
if choose == option:
#escolheu a ultima opcion Finalizar
running = False
else:
credit = input("Número de tarjeta de crédito: ")
save_transaction(prices[choose-1],credit,articles[choose-1])

Issues: the bank rejected the entire transaction file for the next day period!
Not all credit cards were valid
Prices were too high: donut sold for R $ 50,791.42!
There were no issues in the other periods. What happened


The bank changed the order of the data! [Price / Credit Card / Article]


You have attempted of activities on this page