Hi there,
This is my first time programming python, so please don't judge.
So here is my code I want to use:
It looks messy, but here is my question: I want to make it so that when the user inputs a wrong answer (such as 1) it goes back to the start of the question. And when they input a correct answer, i want it to go to the next question.
Is there anyway I can do that?
Thanks,
salm2s
This is my first time programming python, so please don't judge.
So here is my code I want to use:
print("What is 10 to the power of 2?")
words = ['1', '2000', '100', '10000000']
for w in range(len(words)):
print(w, words[w])
w = int(input("Please type an answer: "))
if w == 100:
print("YAY!!!")
elif w == 1:
print("NOPE XD")
elif w == 2000:
print("NOPE XD")
elif w == 10000000:
print("NOPE XD")
else:
print("Where u get that lol hehe")
if w == 100:
print("--------------------------------------------------------------------------------")
print("Next Question!")
print("""\
What is the discriminant formula?
Hint: Type the number corresponding to the answer
""")
words = ["δ=b²-4ac", "δ=b²+4ac", "δ=4ac-b²", "4ac-b²+4ac=δ"]
for w in range(len(words)):
print(w, words[w])
w = int(input("Please enter a number: "))
if w == 0:
print("Correct!")
elif w == 1:
print("Incorrect")
elif w == 2:
print("Incorrect")
elif w == 3:
print("Incorrect")
else:
print("Where u get that lol hehe")
It looks messy, but here is my question: I want to make it so that when the user inputs a wrong answer (such as 1) it goes back to the start of the question. And when they input a correct answer, i want it to go to the next question.
Is there anyway I can do that?
Thanks,
salm2s
Last edited: