Get startedGet started for free

Python as a calculator

Python is perfectly suited to do basic calculations. It can do addition, subtraction, multiplication and division.

The code in the script gives some examples.

Now it's your turn to practice by writing some code yourself.

This exercise is part of the course

Introduction to Python

View Course

Exercise instructions

  • Print the result of subtracting 5 from 5 under # Subtraction using print().
  • Print the result of multiplying 3 by 5 under # Multiplication.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Addition and division
print(4 + 5)
print(10 / 2)

# Subtraction
print()

# Multiplication
Edit and Run Code