Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a code using python that runs the quiz in the picture below with the same

ID: 3880267 • Letter: C

Question

Create a code using python that runs the quiz in the picture below with the same questions. At the end it must calculate the users score. I've started on mine and got everything to work except the calculating part. Use my code to finish the program.

To create a running total of the number correct, create a variable to store this score. Set it to zero. With an if statement, add one to the variable each time the user gets a correct answer. (How do you know if they got it correct? Remember that if you are printing out “correct” then you have already done that part. Just add a line there to add one to the number correct.) Calculate the percentage by using a formula at the end of the game. Don't just add 20% for each question the user gets correct. If you add 20% each time, then you have to change the program 5 places if you add a 6th question. With a formula, you only need 1 change.

PLEASE HELP

MY CODE:

correct = 0

total_questions = 5

#harry potter

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")

correct+=1

#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")

correct+=1

#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")

correct+=1

#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")

correct+=1

#multiple choice question two

dollarbill = int(input("Who is on the front of a one dollar bill 1. GeorgeWashington 2. AbrahamLincoln 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")

correct+=1

  

if correct==20:

print("You got zero answers right.")

else:

print("Congratulations. You got",correct,"answers right.")

print("That is a score of ",(correct*100)/total_questions*1.0,"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 Correct! Who is on the front of a one dollar bill 1. George Washington 2. Abraham Lincoln 3. John Adams 4. Thomas Jefferson No Congratulations, you got 4 answers right That is a score of 86. percent.

Explanation / Answer

correct = 0

total_questions = 5

#harry potter

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")

correct+=1

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")

correct+=1

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")

correct+=1

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")

correct+=1

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. GeorgeWashington 2. AbrahamLincoln 3. John Adams 4. Thomas Jefferson ?"))

if dollarbill == 1:

#if answer is 1 then print correct

print("correct")

correct+=1

else:

#if answer is anything other than 1 then print incorrect

print("incorrect")

print("Done")

  

if correct==20:

print("You got zero answers right.")

else:

print("Congratulations. You got",correct,"answers right.")

print("That is a score of ",(correct*100)/total_questions*1.0,"percent.")

""" Thre is no issue in caluctation part. The increment of correct statement is in incorrect position""

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote