Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. import random
  2.  
  3. def chooser():
  4. number = random.randrange(3)
  5. if number == 0:
  6. options['special meal at home'] += 1
  7. if number == 1:
  8. options['BBQ with GOLPE'] += 1
  9. if number == 2:
  10. options['romantic kebab dinner'] += 1
  11.  
  12. options = {'special meal at home': 0, 'BBQ with GOLPE': 0, 'romantic kebab dinner': 0}
  13. upper = 1e5
  14.  
  15. for i in range(int(upper)):
  16. chooser()
  17.  
  18. winner = max(options, key=options.get)
  19. # for keys, value in options.items():
  20. # print('{0} = {1}'.format(keys, value))
  21. print('Winner: {0} with {1} votes'.format(winner, options[winner]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement