I'm writing a script that takes in user input at multiple points. If the input is correct, all I need is to break out of the loop and continue. But if it's wrong, what I'm trying to do is delete and then re-prompt for that input. Here is a general case of what I'm working towards:
while True:
test = input("Enter test to check: ")
if test == expected:
break
else:
print("Error: test is incorrect")
#Clear/overwrite test
#Re-prompt for input
I've been doing some research but I haven't found anything that really makes sense to me. Is there a way to delete or overwrite the value entered by the user so that once test is entered again, it's an entirely new value?
test=Noneafter theelseif for some reason you want to "destroy" the user input.