Addition
Python provides arithmetic operators that allow us to perform arithmetic operations. The following include arithmetic operations in Python, along with their meaning:
First, let's take a look at how the numbers are added.
python9123456789Input:num_1 = 5num_2 = 34.5sum = num_1 + num_2print(f'The sum of {num_1} and {num_2} is {sum}')Output:The sum of 5 and 34.5 is 39.5
Now it's your turn to test your strength.
Uppgift
Swipe to start coding
You have 2 integers, add them.
Lösning
9
1
2
3
4
5
a = 245
b = 653
sum = a + b
print(f'The sum of {a} and {b} is {sum}')
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 6
single
9
1
2
3
4
5
a = 245
b = 653
sum = _ _ _
print(f'The sum of {a} and {b} is {_ _ _}')
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal