Skip to content

Commit 32c6d4c

Browse files
committed
.
1 parent 984d0f9 commit 32c6d4c

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

ex069.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
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+

ex070.py

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
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}')

ex072.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
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.

0 commit comments

Comments
 (0)