Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (anonymous):

Wanting to create a small quiz for my students, wondering where I'm going wrong: score = 0 questions = ['What is the colour of Bledisloe?','What is the colour of Carruth?','What is the colour of Hobson?','What is the colour of Marsden?','What is the colour of Grey?'] answers = ['Yellow','Black','Green','Blue','Red']for i in questions: raw_input(i)for j in answers: if i == j:score += 1 print ("Your score is: " + str(score)) #I want to check to see if their raw_input is equal to the answer stored in the variable Answers1 And sorry can't remember how to get it to show up indented and formatted like I've done in IDLE

OpenStudy (anonymous):

I don't think you need to loop through the answers. I would imagine you are expecting a string answer, then you could do if answer in answers: score+=1

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!