Hey guys, so i started doing number guess and got pretty far in, however whenever i would enter python NumberGuess.py it would always show up as is the image i linked
I watched the youtube video to see what the guy did and i basically had the exact same thing as him yet i still can’t get it to work. Even when i go back to task 17 where it asks for you to give it a try i still get the same result.
here is my code:
""" This is a game to guess the number equal to 2 die's thrown in the simulation! """ from random import randint from time import sleep def get_user_guess(): guess = int(raw_input("guess a number!: ")) return 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 "the maximum possible value is %d" % max_val guess = get_user_guess() if guess > max_val: print "%d is tool large" % guess else: print "Rolling..." sleep(2) print "The 1st roll is %d" % first_roll print "The 2nd roll is %d" % second_roll sleep(1) total_roll = first_roll + second_roll print "The total value is %d" % total_roll print "Result..." sleep(1) if guess == total_roll: print "Congratulations! You have won!" else: print "Sorry mate, you have lost" roll_dice(6)
also link to the lesson https://www.codecademy.com/courses/learn-python/projects/number-guess?action=resume_content_item