# Futurelearn maths and logic course game from random import randint secret = randint(1,20) guess = 0 tries = 0 print(str(secret) + "Try to guess a number between 1 and 20, using the four clues if you need them. You have 5 guesses.") while (guess != secret) and (tries < 5): guess = int(input("What is your guess? ")) tries += 1 if guess == secret: print("You got it!") elif tries == 1: print("This is your first clue. Your guess was ", end = '') if guess < secret: print("too low.") else: print("too high.") elif tries == 2: print("This is your second clue. The number you are trying to guess is ", end = '') if secret%2 == 0: print("divisable by 2.") else: print("not divisable by 2.") elif tries == 3: print("No, sorry, your third clue is that the modulus of the secret number divided by 3 is " + str(secret%3) + ".") elif tries == 4: print("Down to your last guess. The answer to '20//5' is ", end = '') if 20//5 > secret: print("greater than the secret number.") else: print("less than the secret number.") else: print("Game over.") if guess != secret: print("\nWrong, sorry, you have used up your five guesses. Better luck next time.") print("\nThe secret number was " + str(secret) + ".")