1+ # The input() function takes input from the user and returns it.
2+ # A função input() recebe o input do utilizador e devolve.
3+
4+ sinal = input ("Escolhe um sinal (+ - * /): " )
5+
6+ # A float is a floating point number which is a computers representation of a real number
7+ # Um float é floating point number que é uma representação informática de um número real.
8+
9+ numero1 = float (input ("Escolhe o primeiro número: " ))
10+ numero2 = float (input ("Escolhe o segundo número " ))
11+
12+ # This is read as if the signal is + then add numero1 to numero2 resulting in a sum and then print is used
13+ # to show us the result. The "round" is used for rounding the numbers.
14+
15+ # Isto é lido como se o sinal fosse +, então adiciona o número1 ao número2, resultando numa soma
16+ # e depois é utilizado o print para nos mostrar o resultado. O "round" é utilizado para arredondar os números.
17+
18+ if sinal == "+" :
19+ result = numero1 + numero2
20+ print (round (result , 3 ))
21+ # In here we have the elif, which means if the previous conditions were not true, then try this condition.
22+ # Aqui temos o elif, que significa que se as condições anteriores não forem verdadeiras, então tenta esta condição.
23+
24+ # It's worth noting that in the "round" we're using 3, which means we're rounding to 3 decimal places.
25+ # Vale a pena referir que no "round" estamos a utilizar 3 o que significa que estamos a arrondar para 3 casas decimais.
26+ elif sinal == "-" :
27+ result = numero1 - numero2
28+ print (round (result , 3 ))
29+ elif sinal == "*" :
30+ result = numero1 * numero2
31+ print (round (result , 3 ))
32+ elif sinal == "/" :
33+ result = numero1 / numero2
34+ print (round (result , 3 ))
35+
36+ # Here I find it difficult to understand the "f" string, with research I saw that F strings provide a convenient way
37+ # of incorporating formatting expressions But even with this description I have a little trouble understanding.
38+ # anyways it's used a print to display a message.
39+ # Aqui demonstro dificuldade em perceber o "f" string, com pesquisa vi que a F strings fornecem uma forma conveniente
40+ # de incorporar expressões formatação Mas mesmo com esta descrição tenho um pouco de dificuldade em perceber.
41+ # de qualquer forma, é utilizado um print para mostrar uma mensagem.
42+ else :
43+ print (f"{ sinal } não é valido" )
0 commit comments