t403.py 506 B

1234567891011121314151617181920212223242526
  1. print "EVALUATE TO TRUE:"
  2. # list
  3. print any([True,1,5.0,-33L,'hello',(3,4,5),[-6,7,10.0],{17:'true',-11L:True},False])
  4. # str
  5. print any('hello')
  6. print any('false')
  7. # tuple
  8. print any((3,4,5))
  9. print any((3,4,))
  10. print any((1,0))
  11. # dict
  12. print any({1:10,-2:'hello',0L:False,(2,3):True})
  13. print "EVALUATE TO FALSE:"
  14. # list
  15. print any([None,False,0,0L,0.0,'',(),[],{}])
  16. print any([])
  17. # string
  18. print any("")
  19. print any('')
  20. # tuple
  21. print any((0,0.0,0L))
  22. print any(())
  23. # dict
  24. print any({0:False,0.0:None})
  25. print any({})