Skip to content

Commit 562cca7

Browse files
committed
doc: add comments
exercises with commented arithmetic operators.
1 parent f1e11a7 commit 562cca7

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

ex012.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@
33
print('...Calculating the discount...')
44
discount = product - (product * 0.15)
55
print('Your product R${} with 15% of discount will be R${:.2f}'.format(product, discount))
6+
7+
#12: Faça um algoritmo que leia o preço de um produto e mostre seu novo preço, com 5% de desconto.
8+
'''produto = float(input('Informe o valor do produto em R$:'))
9+
desconto = produto * 0.05
10+
print(f'Seu produto que custa {produto:.2f}, com desconto de 5%, ficará R${produto- desconto:.2f}')'''
11+
12+
#PT- mais um treino de operadores aritméticos.
13+
#EN- another training in arithmetic operators

ex013.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@
33
print('Calculating you new salary with a 15% increase...')
44
increase = salary + (salary * 0.15)
55
print(f'Your new salary will be R${increase}.')
6+
7+
#13: Faça um algoritmo que leia o salário de um funcionário e mostre seu novo salário, com 15% de aumento.
8+
'''salario = float(input('Digite o valor do seu salário em R$:'))
9+
aumento = salario * 0.15
10+
print(f'Seu salário de R${salario:.2f}, com aumento de 15% ficará R${salario+aumento:.2f}')'''
11+
12+
#PT- mais um treino de operadores aritméticos.
13+
#EN- another training in arithmetic operators

ex014.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@
22
celsius = int(input('Enter a temperature in Celsius:'))
33
fahrenheit = ( celsius * 1.8) + 32
44
print(f'If the temperature local is {celsius}°C converting it will be {fahrenheit}°F.')
5+
6+
#14: Escreva um programa que converta uma temperatura digitando em graus Celsius e converta para graus Fahrenheit.
7+
'''celsius = int(input('Digite o valor da temperatura em celsius:'))
8+
print(f'Convertendo {celsius}ºC para Fahrenheit ficará: {(celsius * 1.8) + 32}ºF.')'''
9+
10+
#PT- mais um treino de operadores aritméticos.
11+
#EN- another training in arithmetic operators

ex015.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
#15- Write a program that asks the number of km traveled by a rented car and the number of days for which
22
# it was rented. Calculate the price to pay, knowing that the car costs R$60 per day and R$0.15 per km driven.
3-
km = int(input(' Enter how many Km you have driven the car:'))
3+
'''km = int(input(' Enter how many Km you have driven the car:'))
44
day = int(input('How many days did you keep the car:'))
55
value_day = day * 60
66
value_km = km * 0.15
7-
print('If you stayed {} days with the carand it ran {}Km with him, then you must pay R${}.'.format(day, km, (value_day +value_km)))
7+
print('If you stayed {} days with the carand it ran {}Km with him, then you must pay R${}.'.format(day, km, (value_day +value_km)))'''
8+
9+
10+
#15: Escreva um programa que pergunte a quantidade de Km percorridos por um carro alugado e a quantidade de dias pelos
11+
# quais ele foi alugado. Calcule o preço a pagar, sabendo que o carro custa R$60 por dia e R$0,15 por Km rodado.
12+
km = float(input('Quantos Km você rodou com o carro?'))
13+
dias = int(input('Quandos dias você ficou com o carro alugado?'))
14+
valor_km = km * 0.15
15+
valor_dia = dias * 60
16+
print(f'Se você rodou {km}km e ficou {dias} dias com o carro, logo você deverá pagar R${valor_dia + valor_km} de locação do carro.')
17+
18+
#PT- mais um treino de operadores aritméticos.
19+
#EN- another training in arithmetic operators

0 commit comments

Comments
 (0)