fork download
  1. import random
  2.  
  3. numblist = []
  4. count = 0
  5. def main():
  6. for x in range(0, 101):
  7. numblist.append(number())
  8. print (numblist)
  9.  
  10. def number():
  11. return random.randrange(1,101)
  12.  
  13. main()
  14.  
  15. odd = []
  16. even = []
  17.  
  18. def sort():
  19. for item in numblist:
  20. if item % 2 != 0:
  21. odd.append(item)
  22. if item % 2 == 0:
  23. even.append(item)
  24. sort()
  25.  
  26. print ("odd: ", odd)
  27. print ("even: ", even)
  28.  
  29. print ("Sum of odd: ", sum(odd))
  30. print ("Sum of even: ", sum(even))
  31.  
Success #stdin #stdout 0.03s 10976KB
stdin
Standard input is empty
stdout
[11, 5, 69, 78, 80, 80, 32, 42, 90, 77, 89, 30, 22, 3, 3, 99, 74, 35, 15, 60, 56, 84, 62, 13, 33, 31, 80, 80, 33, 11, 18, 21, 76, 43, 83, 73, 75, 83, 83, 70, 95, 7, 3, 85, 93, 56, 51, 85, 32, 63, 84, 23, 92, 51, 53, 14, 25, 20, 94, 77, 80, 65, 44, 35, 57, 83, 93, 17, 32, 6, 49, 36, 63, 7, 55, 78, 2, 78, 30, 25, 99, 59, 36, 7, 14, 97, 32, 62, 97, 75, 11, 80, 69, 73, 23, 64, 12, 34, 34, 90, 38]
odd:  [11, 5, 69, 77, 89, 3, 3, 99, 35, 15, 13, 33, 31, 33, 11, 21, 43, 83, 73, 75, 83, 83, 95, 7, 3, 85, 93, 51, 85, 63, 23, 51, 53, 25, 77, 65, 35, 57, 83, 93, 17, 49, 63, 7, 55, 25, 99, 59, 7, 97, 97, 75, 11, 69, 73, 23]
even:  [78, 80, 80, 32, 42, 90, 30, 22, 74, 60, 56, 84, 62, 80, 80, 18, 76, 70, 56, 32, 84, 92, 14, 20, 94, 80, 44, 32, 6, 36, 78, 2, 78, 30, 36, 14, 32, 62, 80, 64, 12, 34, 34, 90, 38]
Sum of odd:  2858
Sum of even:  2388