Advertisement
cookertron

Olisa Jeremiah - Help

Apr 21st, 2020
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. results = [
  2. 'jane', 4,
  3. 'jane', 7,
  4. 'jane', 3,
  5. 'boi', 5,
  6. 'boi', 5,
  7. 'boi', 7,
  8. 'jude', 10,
  9. ]
  10.  
  11. total = {}
  12. for index in range(0, len(results), 2):
  13.     if not results[index] in total:
  14.         total[results[index]] = results[index + 1]
  15.     else:
  16.         total[results[index]] += results[index + 1]
  17.    
  18. print(total)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement