Tom_Jung

Untitled

Jan 22nd, 2019
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. def roll_dice(num):
  2.  
  3. import random
  4.  
  5. # possible score are 2,3, ....,11, 12 for two dice
  6. scores =[0]*11
  7. for i in range(num):
  8.  
  9. dice1 = random.randint(1,6)
  10. dice2 = random.randint(1,6)
  11.  
  12. total = (dice1 + dice2)-2
  13.  
  14. scores[total]= scores[total] + 1
  15.  
  16. return scores
  17.  
  18. print(roll_dice(100))
Advertisement
Add Comment
Please, Sign In to add comment