
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















Ruth Anderson UW CSE 160 Autumn 2021
x = 2 x y = y x = 5 x y
22 > 4 22 < 4 22 == 4 x = 100 # Assignment, not conditional! 22 = 4 # Error! x >= 5 x >= 100 x >= 200 not True not (x >= 200) 3 < 4 and 5 < 6 4 < 3 or 5 < 6 temp = 72 water_is_liquid = temp > 32 and temp < 212 Order of Precedence: Numeric operators: +, *, ** Mixed operators: <, >=, == Boolean operators: not, and, or 13 Also: see a program printing these expressions in python tutor Try typing these expressions into a python interpreter
What is printed out by the following Python code:
temp = 72 is_liquid = temp > 32 and temp < 212 print(is_liquid) temp = 300 print(is_liquid) See this program in python tutor
15.0 / 4. 15 / 4 # Would have been truncated in Python 2. 15.0 / 4 15 / 4. Type conversion: float(15) int(15.0) int(15.5) int("15") str(15.5) float(15) / 4 See a program printing these expressions in python tutor Try typing these expressions into a python interpreter