Im working on a program that asks the user to enter input twelve times. Those inputs must be included in a list in which there are included the first twelve letters of the alphabet.
letters=("A","B","C","D","E","F","G","H","I","J","K","L")
def gen_():
s = []
for i in range(1, 13):
in_ = input("Input the note number " + str(i) + ", please\n", )
if in_ in letters:
s.append(in_)
print(" \n"+str(s)+"\n " )
else:
print("not valid")
gen_()
I would like to tell the program that if a certain input is not valid, it should ask the user to try again and enter a valid input on that same instance. I tried setting "i" back to the value in which the input was not valid, by subtracting 1 to i, but it didn´t work.
How can I code this? Thanks