0

I am new to python programming and stack overflow too. I have to limit user input for the a multiple choice question.ie, a , b, c, d for example. I don't want user to input a character other than a, b, c or d.

def test(questions):
    score = 0
    for question in questions:
        answer = input(question.prompt)
        if answer == question.answer:
            score += 1

    print("You scored " + str(score) + "/" + str(len(question_prompt)))


test(questions)
Ukiyo
  • 327
  • 1
  • 4
  • 13
Sahil pc
  • 1
  • 1

0 Answers0