Skip to content

Commit 4d1635d

Browse files
committed
doc: add comments
Conditional exercises (if, elif, else). Eletronic radar.
1 parent 3ba548a commit 4d1635d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

ex029.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
#Electronic radar
12
#29- Write a program that reads the speed of a car. If it exceeded 80km/h, show a message saying that it
23
# was fined. The fine will cost R$7.00 for each km above the limit.
34
speed = float(input('Enter the speed of your car:'))
45
if speed > 80:
56
print('FINED!!!! You have exceeded the 80Km/h limit.')
67
fined = (speed - 80) * 7
7-
print(f'You will need for a fine of R${fined}.')
8+
print(f'You will need for a fine of U${fined:.2f}.')
89
print(f'Have a nice day! Drive safely!')
10+
11+
12+
# Radar eletrônico
13+
#29: Escreva um programa que leia a velocidade de um carro. Se ele ultrapassar 80Km/h, mostre uma mensagem dizendo que
14+
# ele foi multado. A multa vai custar R$7,00 por cada Km acima do limite.
15+
velocidade = float(input('Qual a velocidade do carro?'))
16+
if velocidade > 80:
17+
print(f'Você passou {velocidade - 80}Km/h do limite e deverá pagar R${(velocidade - 80)*7:.2f}')
18+
19+
20+
#PT- Exercícios com uso de condicional.
21+
#EN- Exercises using conditional.

0 commit comments

Comments
 (0)