VisuAlg Web

Matemática Básica

Os operadores matemáticos em Python são + , - , * , / e // (divisão inteira).

Os operadores matemáticos em Python são +, -, *, / e // (divisão inteira).

Exemplo de códigoPython


num1 = 10
num2 = 3

print("Sum: ", num1 + num2)
print("Multiplication: ", num1 * num2)
print("Real division (/): ", num1 / num2)
print("Integer division (//): ", num1 // num2)
Exemplo de códigoPython


base = 5
exponent = 2
print("5 squared is: ", base ** exponent)

# 10 divided by 2 leaves nothing, so the remainder is 0 (it is even!)
remainder = 10 % 2
print("The remainder of 10 divided by 2 is: ", remainder)