r/learnpython • u/ParkingDiligent1002 • Feb 21 '24
HOW TO READ A PYTHON CODE ON REPEAT PLEASE
Hello i am a 14 years old python big noob and i am trying to do my first ever project, i need help for completing iT
import random
value = random.randint(0, 1000)
guess = int(input("What is your first guess ? "))
if value <= guess:
print("Its Less")
if value >= guess:
print("its More")
if value == guess:
print("Correct !!")
so i want to make this guess the number little game but my problem is that every time the guess is not right i have to restart manually the whole program and it looses my guess + changes the value so its basically impossible. Please i want to know how to just read it on repeat without loosing my guess nor the value.