Lesson 5 of 34
Maths with Operators
7 min 20 XP
Python is a powerful calculator. / is decimal division, // is whole-number division, % is the remainder, and ** is power.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.Just like in maths, * and / are calculated before + and -. Brackets ( ) are calculated first.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.To check if a number is even: if n % 2 is 0, it's even.