From 8561dbab9fb63d2ecd2128f83c803f8d4e7b8744 Mon Sep 17 00:00:00 2001 From: samuel Date: Fri, 26 Jun 2020 15:58:27 +0200 Subject: [PATCH] added some final stage to the quiz --- .../.#learn-german.org | 1 + sami/learn-python-the-hard-way/.#quiz2.py | 1 - sami/learn-python-the-hard-way/quiz.py | 20 +++++++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) create mode 120000 sami/learn-python-the-hard-way/.#learn-german.org delete mode 120000 sami/learn-python-the-hard-way/.#quiz2.py diff --git a/sami/learn-python-the-hard-way/.#learn-german.org b/sami/learn-python-the-hard-way/.#learn-german.org new file mode 120000 index 0000000..f748d3d --- /dev/null +++ b/sami/learn-python-the-hard-way/.#learn-german.org @@ -0,0 +1 @@ +sami@afro-linux-lenovo-b50-30.2711:1593172229 \ No newline at end of file diff --git a/sami/learn-python-the-hard-way/.#quiz2.py b/sami/learn-python-the-hard-way/.#quiz2.py deleted file mode 120000 index d7a8c4f..0000000 --- a/sami/learn-python-the-hard-way/.#quiz2.py +++ /dev/null @@ -1 +0,0 @@ -sami@afro-linux-lenovo-b50-30.18673:1593006374 \ No newline at end of file diff --git a/sami/learn-python-the-hard-way/quiz.py b/sami/learn-python-the-hard-way/quiz.py index de9505e..24f27f4 100644 --- a/sami/learn-python-the-hard-way/quiz.py +++ b/sami/learn-python-the-hard-way/quiz.py @@ -29,13 +29,14 @@ questions = [ Question(question_prompts[9], "a"), ] -def run_quiz(questions): +def quiz(questions): score = 0 for question in questions: answer = input(question.prompt) if answer == question.answer: score += 5 print("Correct! Your score is", score,) + else: print("Incorrect!") @@ -43,11 +44,18 @@ def run_quiz(questions): print("You lost 3 points!") print ("Score: ", score) print ("\n") - + +# Final stage +score = 0 +if score >= -30: + print("Your total score is:", score, "- You suck!") + +elif score == 10 or 15 : + print("Your total score is:", score, "- You went ok!") + +else: + print("Your total score is:", score, "- You are awesome!") - - - -run_quiz(questions) +quiz(questions)