Guest User

Untitled

a guest
Jul 18th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. print "100" < "2" # True
  2. print "5" > "9" # False
  3.  
  4. print "100" < 2 # False
  5. print 100 < "2" # True
  6.  
  7. print 5 > "9" # False
  8. print "5" > 9 # True
  9.  
  10. print [] > float('inf') # True
  11. print () > [] # True
  12.  
  13. >>> 5 < 'foo'
  14. True
  15. >>> 5 < (1, 2)
  16. True
  17. >>> 5 < {}
  18. True
  19. >>> 5 < [1, 2]
  20. True
  21.  
  22. >>> [1, 2] > 'foo' # 'list' < 'str'
  23. False
  24. >>> (1, 2) > 'foo' # 'tuple' > 'str'
  25. True
  26.  
  27. >>> class Foo(object): pass
  28. >>> class Bar(object): pass
  29. >>> Bar() < Foo()
  30. True
  31.  
  32. >>> class Foo: pass # old-style
  33. >>> class Bar(object): pass # new-style
  34. >>> Bar() < Foo()
  35. False
  36.  
  37. >>> '10' > 5
  38. Traceback (most recent call last):
  39. File "<pyshell#0>", line 1, in <module>
  40. '10' > 5
  41. TypeError: unorderable types: str() > int()
Add Comment
Please, Sign In to add comment