There are I have two problem please help
problem 1 - input should be integer 1-100 rand_num = random.randint(1,100)
if input goes 100 above then show enter valid number 1 to 100 how could I achieve this please help
Thanks!
and also Could please give me a another suggestion to make my project more better.
import random
LIVES = 10
SCORE = 0
HIGH_SCORE = 0
print("\t\t =============> Welcome to the number guessing game developed by Python <===============\n")
print("You have only 10 lives to guessing the number\n\
")
rand_num = random.randint(1,100)
print(rand_num)
while LIVES >=0:
try:
user = int(input("Choose a number between 1-100 : "))
if user == rand_num:
print("Congratulations You guessed it right.")
SCORE=11-LIVES
if SCORE > SCORE:
SCORE += HIGH_SCORE
print(f"Your score is {SCORE} ")
print(f"The Score Is {HIGH_SCORE}")
break
elif user > rand_num:
LIVES-=1
print(f"Too high! Please guess lower number.\n Current Lives= {LIVES}")
elif user < rand_num:
LIVES-=1
print(f"Too Low! Please guess higher number.\n Current Lives= {LIVES}")
except Exception as e:
print(e)