INPUT, OUTPUT & OPERATORS · 7 MIN
Input, Output & Operators
input() reads text from the user; operators combine values into new ones.
PYRA explains
- input() always returns a string — convert it with int() or float() before doing maths.
- Arithmetic: + - * / (true division), // (floor division), % (remainder), ** (power).
- Comparison operators (==, !=, <, >=) give True or False; and / or / not combine them.
Real world: A billing counter: read the quantity, multiply by price, check if it's above the free-delivery limit.
Code
print(7 / 2, 7 // 2, 7 % 2, 2 ** 5)
print(10 > 3 and 2 == 2)Output ›
3.5 3 1 32
TrueTry it in the online compiler →Checkpoint quiz
What does 17 // 5 give?
What type does input() return?