File tree Expand file tree Collapse file tree 3 files changed +32
-6
lines changed Expand file tree Collapse file tree 3 files changed +32
-6
lines changed Original file line number Diff line number Diff line change 22# ask whether or not the user wants to continue. At the end, show:
33#A) how many people are over 18 years old.
44#B) how many men were registered.
5- #C) how many women are under 20 years old.
5+ #C) how many women are under 20 years old.
6+
Original file line number Diff line number Diff line change 1- # Create a program that reads the name and price of several products. The program should ask the user whether to
2- # continue or not. At the end, show:
3- # A) what is the total amount spent on the purchase.
4- # B) how many products cost more than R$1000.
5- # C) what is the name of the cheapest product.
1+ #070: Crie um programa que leia o nome e o preço de vários produtos. O programa deverá perguntar se o usuário vai
2+ # continuar ou não. No final, mostre:
3+ #A) qual é o total gasto na compra.
4+ #B) quantos produtos custam mais de R$1000.
5+ #C) qual é o nome do produto mais barato.
6+ total = totmil = menor = cont = 0
7+ barato = ' '
8+ while True :
9+ produto = str (input ('Qual o produto que você quer comprar?' ))
10+ preco = float (input ('Qual o valor do produto em R$:' ))
11+ total += preco
12+ if preco > 1000 :
13+ totmil += 1
14+ if cont == 1 :
15+ menor = preco
16+ else :
17+ if preco < menor :
18+ menor = preco
19+ barato = produto
20+ resp = ' '
21+ while resp not in "SN" :
22+ resp = str (input ('Quer continuar? [S/N]' )).strip ().upper ()[0 ]
23+ if resp == 'N' :
24+ break
25+ print ("Fim do programa." )
26+ print (f'O total da compra foi R${ total :.2f} ' )
27+ print (f'Temos { totmil } produtos custando mais de R$1.000,00' )
28+ print (f'O produto mais barato foi { barato } que custa R${ menor :.2f} ' )
Original file line number Diff line number Diff line change 1+ # 72- Create a program that has a pair of numbers filled in completely with a count in words, from zero to twenty.
2+ # Your program should read a number from the keyboard (between 0 and 20) and display it in words.
You can’t perform that action at this time.
0 commit comments