Skip to content

Instantly share code, notes, and snippets.

@ItsCrem
Created November 16, 2017 13:34
Show Gist options
  • Select an option

  • Save ItsCrem/2b10cfb89aae92d1069e839a31903a2b to your computer and use it in GitHub Desktop.

Select an option

Save ItsCrem/2b10cfb89aae92d1069e839a31903a2b to your computer and use it in GitHub Desktop.
guessingGame created by MaxCaminer - https://repl.it/@MaxCaminer/guessingGame
# 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