Here the first exercise is put into the stepper. Since the stepper does not operate in interactive mode, a print is needed to show a result.


Basic Operators

print type(2>2)
print 3-----4
print "Big > small"
print "Big" > "small"
print ["A",2]<["A",3]
print 20 >= 20
print type(3*"three")
print 2**10
print 3*len("three")
print "four".index('o')
print {4:1, 3:2, 2:3, 1:4}[2]
print 8 in {0:7, 1:8, 2:9}
print [True,False,True].index(True)
print 'timing'[-4]


Some perhaps more odd-looking examples are these:


Odd Examples

print 'timing'[-4]+'timing'[-2]
print "\n" in "\\nn"
print 5*(6,)
print {1<2:2>1,1>2:2<1}[0<0]