## Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today. # kindly find the *** i am doing it wrong

```     import random

def game():
guess_num = random.randint(1, 10)
print(guess_num)
chance_left = 5
count = 1
print("Guess a number between one and ten and try your luck.")
print("""
Number of chances left is {}
""".format(chance_left))
while True:
chance_left -= 1
try:
user_num = int(input("Enter any Number from 1 to 10: > "))
except ValueError:
print("That's not a valid number! Kindly enter a number only")
print("Number of chance left is {}".format(chance_left))
count += 1
continue
if user_num == guess_num:
print("""
You got it. My secret number was {}
""".format(guess_num))
break
elif count >= 5:
print("""
5 chances completed. You've lost this game!
""")
choice = input("""
If you want to play again Enter 'Y', if not Enter 'N'
> """ )
if choice.upper() == "Y":
game()
else:
print("""
Thank you for Playing. Good Bye!
""")
break
else:
if user_num < guess_num:
print("""
Too Low. Try again!
""")
else:
print("""
Too High. Try again!
""")
count += 1
if chance_left != 1:
print("""
Number of chances left is {}
""".format(chance_left))
else:
print("""