PYTHON LESSON 4 OF 32

Make Python do the maths

Use +, -, * and / for arithmetic. // gives floor division, % gives a remainder and ** means power. Parentheses control the order, just like school maths.

हिन्दी में समझें

गणना के लिए +, -, *, / लगाएँ। // पूर्ण भागफल, % शेष और ** घात देता है। कोष्ठक से गणना का क्रम तय होता है।

अभ्यास: 2 की घात 5 का परिणाम प्रिंट करें।

Hinglish mein samjhein

Maths ke liye +, -, *, / use karo. // floor division, % remainder aur ** power hai. Brackets pehle calculate hote hain.

Practice: 2 ki power 5 print karo.

A small Python example

print(10 + 3)
print(10 % 3)
print(2 ** 3)

The browser playground runs real Python with Pyodide. Use sample variables instead of interactive input(). Browser package support differs from desktop Python.

Try this example in the Python playground →

Practise this idea

Add a calculation that prints 2 to the power of 5.

Check answer & explanation
print(10 + 3)
print(10 % 3)
print(2 ** 3)
print(2 ** 5)

Python uses ** for exponentiation. 2 ** 5 multiplies five factors of 2, giving 32.

Stuck in the course? Choose Check answer for either the challenge or quiz. Read the explanation and continue to the next lesson at your own pace.

Check your understanding

What is 10 % 3?

  1. 3
  2. 1
  3. 0
Check the quiz answer

1

3 fits into 10 three times, leaving a remainder of 1.

References & corrections

Use the official Python documentation for full language rules. Read how these lessons are made and checked. Found a mistake? Report it to Excel Keys with this lesson URL and a reproducible example.

FROM LEARNING TO BUSINESS RESULTS

Need a dashboard for your team?

Excel Keys designs custom Excel and HTML dashboards around your own KPIs and Excel files. They run offline in the browser, so your data stays on your computer.