t425.py 373 B

1234567891011121314151617181920212223242526
  1. l = [1,2,3,4]
  2. t = (1,2,3,4)
  3. d = {1:2,3:4}
  4. # lists
  5. print "\nlists"
  6. print sum([])
  7. print sum([],5)
  8. print sum([1,2,3,4])
  9. print sum(l,5)
  10. # tuples
  11. print "\ntuples"
  12. print sum(())
  13. print sum((),5)
  14. print sum((1,2,3,4))
  15. print sum(t,5)
  16. # dictionaries
  17. print "\ndictionaries"
  18. print sum({})
  19. print sum({},5)
  20. print sum({1:2,3:4})
  21. print sum(d.keys())
  22. print sum(d.values())
  23. print sum(d,5)