added quiz.py more codes

This commit is contained in:
samialazar 2020-06-25 15:46:41 +02:00
parent 9c213de08d
commit 38839f5d3b
4 changed files with 59 additions and 4 deletions

View File

@ -0,0 +1 @@
sami@afro-linux-lenovo-b50-30.18673:1593006374

View File

@ -22,3 +22,11 @@
- The Quiz ends when player types quit
- When you quit the Quiz shows the total points
- ( optional) The Quiz shows total amount of write and wrong answers
* Final stage
# Final stage
if score <= 1:
print("Your total score is:", score, "- You suck!")
elif score == 2:
print("Your total score is:", score, "- You went ok!")
else
print("Your total score is:", score, "- You are awesome!")

View File

@ -4,13 +4,29 @@ class Question:
self.answer = answer
question_prompts = [
"Which word does not much with the German verb aufsatzen?\n(a) to put on\n(b) to set up\n(c) to sit up\n(d) to stop",
"which word does not much with the German verb absagen?\n(a) to cancel\n(b) to refuse\n(c) to decline\n(d) to approve",
"Which word does not match with the German verb aufsetzen? \n(a) to put on \n(b) to set up \n(c) to sit up \n(d) to stop \nAnswer: ",
"which word does not match with the German verb absagen? \n(a) to cancel \n(b) to refuse \n(c) to decline \n(d) to approve \nAnswer: ",
"Which word does not match with the German verb umsteigen? \n(a) to transfer \n(b) to change \n(c) to stay \n(d) to switch \nAnswer: ",
"Which word does not match with the German verb abbiegen? \n(a) to return \n(b) to to bend \n(c) to turn off \n(d) to turn\nAnswer: ",
"Which word does not match with the German verb anbieten? \n(a) to offer \n(b) to demand \n(c) to proffer \n(d) volunteer \nAnswer: ",
"Which word does not match with the German verb beitragen? \n(a) to obligate \n(b) to redound \n(c) to help \n(d) contribute \nAnswer: ",
"Which word does not match with the German verb weiterleiten? \n(a) to forward \n(b) to send \n(c) to pass on\n(d) to replace \nAnswer: ",
"Which word does not match with the German verb abziehen? \n(a) to remove \n(b) to deduct \n(c) to top up \n(d) pull off \nAnswer: ",
"Which word does not match with the German verb anpassen? \n(a) to adjust \n(b) to repair \n(c) to customize \n(d) to adapt \nAnswer: ",
"Which word does not match with the German verb umsetzen? \n(a) to destroy \n(b) to implement \n(c) to translate \n(d) to convert \nAnswer: ",
]
questions = [
Question(question_prompts[0], "d"),
Question(question_prompts[1], "d"),
Question(question_prompts[2], "c"),
Question(question_prompts[3], "a"),
Question(question_prompts[4], "b"),
Question(question_prompts[5], "a"),
Question(question_prompts[6], "d"),
Question(question_prompts[7], "c"),
Question(question_prompts[8], "b"),
Question(question_prompts[9], "a"),
]
def run_quiz(questions):
@ -18,6 +34,20 @@ def run_quiz(questions):
for question in questions:
answer = input(question.prompt)
if answer == question.answer:
score += 1
print("you got", score, "out of", len(questions))
score += 5
print("Correct! Your score is", score,)
else:
print("Incorrect!")
score -= 3
print("You lost 3 points!")
print ("Score: ", score)
print ("\n")
run_quiz(questions)

View File

@ -0,0 +1,16 @@
score = 0
# QUESTION 1
input ("Which verb does not match with the German verb aufsetzen? \n(a) to put on \n(b) to set up \n(c) to sit up \n(d) to stop \nAnswer:
if answer1 == "d" or answer1 == "to stop":
score += 5
print ("Correct!")
print ("Score: ", score)
print ("\n")
else:
print("Incorrect! The answer is choice (d) or to stop)
score -= 3
print("You lost 3 points!")
print ("Score: ", score)
print ("\n")