Last login: Wed Jan 26 13:08:45 on ttys010 Warning: PATH set to RVM ruby but GEM_HOME and/or GEM_PATH not set, see: https://github.com/rvm/rvm/issues/3212 michael at Catalina-Pro in ~ 👉 python3 Python 3.9.1 (default, Feb 3 2021, 07:04:15) [Clang 12.0.0 (clang-1200.0.32.29)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> >>> def max(x, y): return x if x > y else y x = 3 y = 4 + max(17, x + 6) * 0.1 z = x / y File "", line 1 x = 3 y = 4 + max(17, x + 6) * 0.1 z = x / y ^ SyntaxError: multiple statements found while compiling a single statement >>> def max(x, y): return x if x > y else y File "", line 1 ^ SyntaxError: multiple statements found while compiling a single statement >>> >>> def max(x, y): ... return x if x > y else y ... >>> x = 3 >>> y = 4 + max(17, x + 6) * 0.1 >>> z = x / y >>> z 0.5263157894736842 >>> y 5.7 >>> def max(x, y): ... if x > y: ... return x ... else: ... return y ... >>> >>> >>> >>> total = 0 n = 1 while n <= 10: total += n n += 1 print(total) File "", line 1 total = 0 n = 1 while n <= 10: total += n n += 1 print(total) ^ SyntaxError: multiple statements found while compiling a single statement >>> total = 0 >>> num = 1 >>> while n <= 10: ... total += n # total = total + n ... n += 1 ... print(total) File "", line 4 print(total) ^ SyntaxError: invalid syntax >>> >>> while n <= 10: ... total += n # total = total + n ... n += 1 ... Traceback (most recent call last): File "", line 1, in NameError: name 'n' is not defined >>> while num <= 10: ... total += n # total = total + n ... KeyboardInterrupt >>> while num <= 10: ... total += num ... num += 1 ... >>> total 55 >>> num 11 >>> 11 <= 10 False >>>