# addition10 + 5#ans: 15#ans: subtraction10 - 5#ans: 5#ans: multiplication10 * 5#ans: 50
# division (always returns float)10 / 5#ans: 2.010 / 3#ans: 3.3333...#ans: floor division10 // 3#ans: 3
# modulus (remainder)10 % 3#ans: 17 % 3#ans: 115 % 4#ans: 3
# power/exponentiation10 ** 2#ans: 1002 ** 3#ans: 85 ** 0#ans: 1
# PEMDAS rules apply10 + 5 * 2#ans: 20 (multiply first)(10 + 5) * 2#ans: 30 (parentheses first)2 + 3 * 4#ans: 14
# what is the result?7 % 3#ans: 1#ans: division types10 / 3#ans: 3.3333...10 // 3#ans: 3
# negative modulus?-10 % 3#ans: 2# what is this?2 ** 3 ** 2#ans: 512 (right associative: 2^(3^2) = 2^9)
# operator precedence?10 + 5 * 2#ans: 20# what happens?5 / 0#ans: ZeroDivisionError
# floor division with negative?-10 // 3#ans: -4# modulus with float?10.5 % 3#ans: 1.5
# what is result?100 // 10#ans: 10# power of zero?5 ** 0#ans: 1# negative exponent?2 ** -1#ans: 0.5
# order of operations?2 * 3 ** 2#ans: 18 (exponent first)# mixing operations?10 - 5 + 3#ans: 8 (left to right)# division by float?10 / 2.0#ans: 5.0
Google tag (gtag.js)