3. REPL
4. Using Python as Calculator
>>> 17 / 3 # int / int -> int
5
>>> 17 / 3.0 # int / float -> float
5.666666666666667
>>> 17 // 3.0 # explicit floor division discards the fractional part
5.0
>>> 17 % 3 # the % operator returns the remainder of the division
2
>>> 5 * 3 + 2 # result * divisor + remainder
17
** operator to calculate powers
>>> 2 ** 7 # 2 to the power of 7
128
In interactive mode, the last printed expression is assigned to the variable _.
>>> tax = 12.5 / 100
>>> price = 100.50
>>> price * tax
12.5625
>>> price + _ # _ contains 12.5625 (last printed expression)
113.0625
>>> round(_, 2)
113.06Added Comments/Questions: