I can't get the code to ask 2 different times for the same input.
I want to get an input that is in the list [1, 2, 4, 8, 16] but all kind of inputs are "valid" for the program. How can I make it that if the first input is wrong (not in the list) I get to ask again for the same input? This is my code so far:
d = int(input("¿Cuál quieres que sea el valor máximo de duración?\nTen en cuenta que el valor mínimo está definido y es la semicorchea.\n\nSemicorchea = 16\nCorchea = 8\nNegra = 4\nBlanca = 2\nRedonda = 1\n"))
if d == 16:
duraciones.append(0.25)
if d == 8:
duraciones.append(0.5)
if d == 4:
duraciones.append(0.5)
duraciones.append(1)
if d == 2:
duraciones.append(0.5)
duraciones.append(1)
duraciones.append(2)
if d == 1:
duraciones.append(0.5)
duraciones.append(1)
duraciones.append(2)
duraciones.append(4)
if d not in [16, 8, 4, 2, 1]:
int(input("Valor no válido. Debe ser uno de la siguiente lista:\n\nSemicorchea = 16\nCorchea = 8\nNegra = 4\nBlanca = 2\nRedonda = 1"))
(duraciones is another list)