toc: true layout: post description: Beginner level Python Quiz categories: [jupyter]

title: Amitha's Python Quiz

print("Welcome to Amitha's Quiz!")

start = input("Do you want to take Amitha's Quiz?")
score = 0

def ask_for_answer():
    answer = input()
    return answer

def is_answer_right(user_answer, answer):
    global score
    if user_answer == answer:
        score += 1
        print(f"Good job! The answer is {answer}!")
    else:
        print(f"Sorry, incorrect 😢. The right answer was {answer}.")
    print(f"Your score is {score}")


if start.lower() == "yes" or start.lower() == "y":
    print("Great! Good luck 😊")
else:
    print("Take a mindful minute. You got this :)")


print("This game will have 5 questions!")

#Question 1
print("Question 1: What structures programs so that properties and behaviors are bundled into individual objects?")
user_answer = ask_for_answer()
is_answer_right(user_answer, "OOP")

#Question 2
print("Question 2: What are code lines that will not be executed?")
user_answer = ask_for_answer()
is_answer_right(user_answer, "comments")

#Question 3
print("Question 3: what is an integer in python?")
user_answer = ask_for_answer()
is_answer_right(user_answer, "int")

#Question 4
print("Question 4: What is a statement with a hypothesis followed by a conclusion called?")
user_answer = ask_for_answer()
is_answer_right(user_answer, "Object Oriented Programming")

#Question 5
print("Question 5: Translates a program written in a high-level language into a low-level language?")
user_answer = ask_for_answer()
is_answer_right(user_answer, "if-then statement")


if score == 5:
    print("Wow! You know your stuff! Keep up the good work! 🤗")
if score = 1:
    print("Keep studying :)")
else:
    print("You're average :/")
# white_check_mark
# eyes
# raised_hands
Welcome to Amitha's Quiz!
Great! Good luck 😊
This game will have 5 questions!
Question 1: What structures programs so that properties and behaviors are bundled into individual objects?
Good job! The answer is OOP!
Your score is 1
Question 2: What are code lines that will not be executed?
Good job! The answer is comments!
Your score is 2
Question 3: what is an integer in python?
Good job! The answer is int!
Your score is 3
Question 4: What is a statement with a hypothesis followed by a conclusion called?
Good job! The answer is Object Oriented Programming!
Your score is 4
Question 5: Translates a program written in a high-level language into a low-level language?
Good job! The answer is if-then statement!
Your score is 5
Wow! You know your stuff! Keep up the good work! 🤗
You're average :/