Q:

Why wont this program stop after I press 'n'?

Why wont this stop when 'n' is entered? 
I've tried using break on the bottom else but I get errors doing that. That's a common problem I have with break. I have no idea why I'm thrown off with break.
import random

def game():

  secret_num = random.randint(1, 10)
  guesses = []
  while len(guesses) < 5:
    try:
      guess = int(input("Guess a number between 1 and 10: "))
    except ValueError:
      print("{} isn't a number".format(guess))
    else:
        if guess == secret_num:
          print("You got it! The number was {}.".format(secret_num))
          break
        elif guess < secret_num:
          print("My number is higher than {}".format(guess))
        else:
          print("My number is lower than {}".format(guess))
        guesses.append(guess)
  else:
    print("You didn't get it! My number was {}".format(secret_num))
  play_again = input("Do you want to play again? Y/n ")
  if play_again.lower() != 'Y':
    game()
  else:
    print("Bye!")
game()

A:

You convert play_again to a lower-case letter but compare it to an upper-case letter.
You could simply change it to:
if play_again.lower() != 'n':  # 'y' was wrong, right?
    game()
else:
    print("Bye!")
    return    # works also without the explicit return but it makes the intention clearer.

