Simple Addition
Calculate and display the result of 5 + 3. The output should be: 8
Learn basic math operations in Python: addition, subtraction, multiplication, and division.
Python can work as a calculator! Use these operators:
+ addition (сложение)
- subtraction (вычитание)
* multiplication (умножение)
/ division (деление)
Examples / Примеры:
result = 5 + 3 # result is 8
result = 10 - 4 # result is 6
result = 3 * 4 # result is 12
result = 15 / 3 # result is 5.0
You can also print calculations directly:
print(2 + 2) # Will display: 4
Calculate and display the result of 5 + 3. The output should be: 8
Display the results of these calculations on separate lines: - 10 + 5 - 10 - 5 - 10 * 5 - 10 / 5
Create two variables a = 7 and b = 3. Calculate their sum and store it in variable 'total'. Display the total.
Calculate the area of a rectangle with width = 5 and height = 4. Area = width * height Store the result in 'area' and display it.