Question
please write a code that will create this quiz of 5 questions below and will tell you if you're correct or incorrect and then at
please write a code that will create this quiz of 5 questions below and will tell you if you're correct or incorrect and then at the end calculate your score and tell you it.
i will paste my code so far which im stuck on and cant seem to find out what im missing. please fix it.
#Taimoor_Mumtaz #Python #Sun
tot = 0 tot = x +1
harrypotter = int(input("How many books are there in the harry potter series? ")) if harrypotter == 7: #if answer is 7 then it is correct print("correct") else: #if answer is anything other than 7 it is incorrect print("incorrect") print("Done")
#math problem math = int(input("What is 3*(2-1)?")) if math == 3: #if answer is 3 then print correct print("correct") else: #if answer is anything other than 3 then print incorrect print("incorrect") print("Done")
#math problem number 2 math2 = int(input("What is 3*2-1?")) if math2 == 5: #if answer is 5 then print correct print("correct") else: #if answer is anything other than 5 then print incorrect print("incorrect") print("Done")
#multiple choice question blackhorse = int(input("Who sings Black Horse and the Cherry Tree? 1. Kelly Clarkson 2. K.T. Tunstall 3. Hillary Duff 4. Bon Jovi")) if blackhorse == 2: #if answer is 2 then print correct print("correct") else: #if answer is anything other than 2 then print incorrect print("incorrect") print("Done")
#multiple choice question two dollarbill = int(input("Who is on the front of a one dollar bill 1. George Washington 2. Abraham Lincoln 3. John Adams 4. Thomas Jefferson ")) if dollarbill == 1: #if answer is 1 then print correct print("correct") else: #if answer is anything other than 1 then print incorrect print("incorrect") print("Done")
score = tot1 + tot2 + tot3 + tot4 + tot5 if (score == 20): print ("Congratulations, you got 1 answer right.") elif (score == 40): print ("Congratulations, you got 2 answers right.") elif (score == 60): print ("Congratulations, you got 3 answers right.") elif (score == 80): print ("Congratulations, you got 4 answers right.") elif (score == 100): else: print ("Congratulations, you got 5 answers right.") print ("This is a Score of", score, "percent.")
Quiz time! How many books are there in the Harry Potter series? 7 Correct! What is 3 (2-1)? 3 Correct! What is 3*2-1? 5 Correct! Who sings Black Horse and the Cherry Tree? 1. Kelly Clarkson 2. K.T. Tunstall 3. Hillary Duff 4. Bon Jovi ?2 Correct! Who is on the front of a one dollar bill 1. George Washington 2. Abraham Lincoln 3. John Adams 4. Thomas Jefferson ? 2 No. Congratulations, you got 4 answers right. That is a score of 80.0 percentStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started