Skip to content

Commit 9997e27

Browse files
committed
doc: add comments
Exercises with commented arithmetic operators
1 parent 871af35 commit 9997e27

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

ex005.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
#05 Write a program that reads an integer and displays its successor and predecessor on the screen.
22
number = int(input('Enter a number:'))
33
print(f' If the number is \033[35m{number}\033[m,its predecessor is \033[31m{(number-1)}\033[m and his successor is \033[32m{(number+1)}\033[m.')
4+
5+
'''#5: Faça um programa que leia um número Inteiro e mostre na tela o seu sucessor e seu antecessor.
6+
numero = int(input('Digite um número inteiro:'))
7+
print(f'Se o número escolhido foi {numero} seu antecessor é {numero - 1} e seu sucessor é {numero + 1}.'''
8+
9+
#PT- Nesse exercício usamos o int e o input para receber um dado e o print para mostrar o dado, usamos também o f (format)
10+
#EN- In this exercise we use int and input to receive data and print to display the data, we also use f (format)

ex006.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
#06- Create an algorithm that reads a number and shows its double, triple and square root.
22
number = int(input('Enter a number:'))
33
print(f' If the number is {number},\n your double will be {number*2},\n your triple will be {number*3}\n and its square root will be {number**0.5}.')
4+
5+
'''#6: Crie um algoritmo que leia um número e mostre o seu dobro, triplo e raiz quadrada.
6+
numero = int(input('Digite um número inteiro e eu irei analizar:'))
7+
print(f'Se o número foi {numero}, \n Seu dobro é {numero * 2}, \n Seu triplo é {numero * 3}, \n E sua raiz quadrada é {numero**(1/2)}.')'''
8+
9+
#PT- mais um treino de operadores aritméticos.
10+
#EN- another training in arithmetic operators.

ex007.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,12 @@
22
first_note = float(input('Enter your first note:'))
33
second_note = float(input('Enter your second note:'))
44
print(f' If your first note is {first_note} and your second note is {second_note}.\n You avarege will be {(first_note+second_note)/2}.')
5+
6+
'''#7: Desenvolva um programa que leia as duas notas de um aluno, calcule e mostre a sua média.
7+
print('Vamos calcular sua média?')
8+
primeira_nota = float(input('Digite a primeira nota:'))
9+
segunda_nota = float(input('Digite a segunda nota:'))
10+
print(f'A soma das suas notas é {primeira_nota + segunda_nota} logo a sua média será de {(primeira_nota + segunda_nota)/2}')'''
11+
12+
#PT- mais um treino de operadores aritméticos.
13+
#EN- another training in arithmetic operators

ex008.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@
77
{meter*10} Dm,
88
{meter*100} Cm,
99
{meter*1000} Mm.''')
10+
11+
'''#8: Escreva um programa que leia um valor em metros e o exiba convertido em centímetros e milímetros.
12+
valor = float(input('Digite um valor para eu calcular ele em centimetros e milimetros:'))
13+
print(f'O valor é {valor}, convertendo ele para centimetros fica {valor * 100}Cm e em milimetros fica {valor * 1000}Mm.')'''
14+
15+
#PT- mais um treino de operadores aritméticos.
16+
#EN- another training in arithmetic operators

0 commit comments

Comments
 (0)