Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created August 3, 2017 19:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save codecademydev/f7c015bfc44e2da1b12dd825afcdd768 to your computer and use it in GitHub Desktop.
Codecademy export
"""dice
game"""
from random import randint
from time import sleep
def get_user_guess():
user_guess = int(raw_input("Give your variable: "))
return user_guess
def roll_dice(number_of_sides):
first_roll = randint(1,number_of_sides)
second_roll = randint(1,number_of_sides)
max_val = number_of_sides * 2
print "Your max possible value is " + str(max_val)
sleep(1)
user_guess = get_user_guess
if user_guess > max_val:
print "boo"
else:
print "Rolling..."
sleep(2)
print "The first value is: %d" % first_roll
sleep(1)
print "The second value is: %d" % second_roll
sleep(1)
total_roll = first_roll + second_rule
print "Result... %d" % total_roll
sleep(1)
if user_guess > total_roll:
print "winner"
else:
print "loser"
roll_dice(6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment