Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. """comment"""
  2. from random import randint
  3. from time import sleep
  4.  
  5. def get_user_guess():
  6. user_guess = int(raw_input("Guess a number:"))
  7. return user_guess
  8.  
  9. def roll_dice(number_of_sides):
  10. first_roll = random.randint(1, number_of_sides)
  11. second_roll = random.randint(1, number_of_sides)
  12. max_val = number_of_sides * 2
  13. print "The maximum is" + str(max_val)
  14. time.sleep(1)
  15. user_guess = get_user_guess()
  16. if user_guess > max_val:
  17. print "That number is too high"
  18. return
  19. else:
  20. print "Rolling"
  21. time.sleep(2)
  22. print "The first roll is %d" % (first_roll)
  23. time.sleep(1)
  24. print "The second roll is %d" % (second_roll)
  25. total_roll = first_roll + second_roll
  26. print "The total of both rolls is %d" % (total_roll)
  27. print "Result..."
  28. time.sleep(1)
  29. if user_guess > total_roll:
  30. print "you won"
  31. return
  32. else:
  33. print "you lost you fucking swine"
  34. return
  35.  
  36. roll_dice(6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement