#run foogoo foo() go0() x = foo() x x=goo() x print x def f3(): return 3 print "done" f3() def f4(): print "done" return 3 f3() #Back to slides. def f(x): x= 5 print x x=9 x f(x) x true #note that true is not a keyword, but you still shouldn't use it for anything. True type(True) not True True and True True and False False or True x=True not x x and x#back to slides #relational operators 5>3 3>5 4>2.0 4==4.0 #Note that it's still a good idea to make the types match in a relational expression, because sometimes values aren't what you'd expect. x=5 x!=5.0 x>=5 #back to slides. #Bad style 5+7<4*3 or 1-2 >2-4 and 15==4 #Better to use parentheses if you aren't sure. ((5+7)<(4*3)) or ((1-2) >(2-4)) and (15==4) #weirdness starts x=4 x and True #This is because python considers any non-0 numbers to be true. x=-2 x and True x=x +True x x=x+False x #True is represented as 1, False as 0. #Short-circuit evaluation weirdness. x=4.0 or True x= True or 4.0 #Really bad style 5+7<4*3 or 1-2 >2-4 and 15 #Back to slides. x = True x print x