Python Challenge:
In red below is a python programs you can copy into python and run.
- Save and Run the code to see what it does.
- Check the code for errors.
- See if you can change the code to a quiz about football, music or celebrities.
- See if you can change the scoring system so a correct answer gets two points.
- See if you can add new questions into the quiz.
- Add #comments to the code to try to explain and anotate what the code does.
- Explain in your comments what \n does, what if & else do, what +1 does.
- Try to improve the code to make it better.
#quiz maker ask 3 multiple choice, add up answers.
score=0
score=int(score)
print("\n Q1: What is the name of the pub in Eastenders?")
print(" a) Queen Liz?\n b) Queen Bet?\n c) Queen Vic?")
answer1="c"
response1=input("Q1: Answer: ")
if (response1 != answer1):
print("Sorry, that is incorrect!")
else:
print("Well done! " + response1 + " is correct!")
score = score + 1
print("Your current score is " + str(score) + " out of 3")
print("\n Q2: Who is Prince Harry's Brother?")
print(" a) Charles?\n b) William?\n c) Edward?")
answer2="b"
response2=input("Q2: Answer: ")
if (response2 != answer2):
print("Sorry, that is incorrect!")
else:
print("Well done! " + response2 + " is correct!")
score = score + 1
print("Your current score is " + str(score) + " out of 3")
print("\n Q3: What is the capital of France?")
print(" a) Paris?\n b) London?\n c) New York?")
answer3="a"
response3=input("Q3: Answer: ")
if (response3 != answer3):
print("Sorry, that is incorrect!")
else:
print("Well done! " + response3 + " is correct!")
score = score + 1
print("Your final score is " + str(score) + " out of 3")