Created
November 16, 2017 13:34
-
-
Save ItsCrem/2b10cfb89aae92d1069e839a31903a2b to your computer and use it in GitHub Desktop.
guessingGame created by MaxCaminer - https://repl.it/@MaxCaminer/guessingGame
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Guessing game from 1-10 | |
| import random | |
| answer = random.randint(0, 3) | |
| print("Please guess a number from 1-10!") | |
| guess = int(input()) | |
| if (guess != answer): | |
| if (guess < answer): | |
| print("Guess higher!") | |
| else: # If guess is higher than the answer | |
| print("Guess lower!") | |
| guessTwo = int(input()) | |
| if (guessTwo == answer): | |
| print("Well done you guessed the number correctly") | |
| else: # If answer is guessed incorrectly a second time! | |
| print("You guessed the number incorrectly!") | |
| print("You guess was off by {0}!".format(abs(answer - guessTwo))) | |
| else: # If answer is correct on the first attempt | |
| print("Excellcent work! You guess it on the first time!") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment