1
I have tried several times, I can print the largest amount, I can print the date of the biggest sale, my problem is at the time of the loop, code follows the loop as this in command, only when he wants, help me , I spent hours trying to find the error.
- A record store notes daily during the month of March the amount of records sold. Determine on which day of that month the largest sale took place and what was the amount of records sold on that day.
Follows the code:
def main():
qtd=int(input("Informe a quantidade"))
valor=2
i=1
dia=0
maior=0
while i <=5:
maior=qtd
i = i + 1
qtd = int(input("Informe a quantidade"))
if maior > qtd:
maior_qtd=maior
dia=i-1
maior_venda=maior_qtd*valor
print("A maior venda foi {} ".format(maior_qtd))
print("O valor da maior venda foi {}R$ ".format(maior_venda))
print("A maior venda foi no dia {}/3".format(dia))
main()
Upshot :
Informe a quantidade 9 Informe a quantidade 4 A maior venda foi 9 O valor da maior venda foi 18R$ A maior venda foi no dia 1/3 Informe a quantidade
The loop is 1 through 5 - and it only does two repetitions.
Sorry for the lack of identação, first time I publish, happened of I copy and paste, and I did not pay attention to that fact. Thank you so much for helping me, I have some very grotesque difficulties in applying logic, and the way you wrote your code with the comments, were perfect.
– user84098
I registered here yesterday, also I did not know how to move right. I edited the post some 10x hehehe, but very good to know that managed to understand friend. I hope I’ve helped and good luck with your projects!
– mistake S
Thank you very much brother, helped and very much !
– user84098