Hackathon Challenge: Create a Python Quiz Game

Objective: Build a fun and interactive quiz game that can run in the console. The game should ask the player a series of questions and give feedback based on the player’s answers. Teams are encouraged to add a scoring system, multiple choice questions, and enhance the game’s interactivity and design.

Setup Instructions

  1. Create a new Python repl on Replit.
  2. Name your project “QuizGameChallenge”.

Game Requirements

  1. Welcome Screen: Display a welcome message to the player.
  2. Questions: The game should have at least 5 questions. You can choose any theme for your questions, such as general knowledge, coding trivia, or something related to your favorite book or movie.
  3. Answer Input: After each question, the player should be able to type their answer.
  4. Check Answers: The game should check if the player’s answer is correct.
  5. Score Keeping: Keep track of how many questions the player has answered correctly.
  6. End of Game: Display the player’s final score and a message based on their performance.

Sample Code Snippets

Welcome Screen and Asking a Question

print("Welcome to the Quiz Game!")
question1 = "What is the capital of France?"
print(question1)
answer1 = input("Your answer: ").lower().strip()

Checking an Answer

if answer1 == "paris":
    print("Correct!")
    score += 1
else:
    print("Wrong! The correct answer is Paris.")

Main Game Loop and Questions

questions = {
    "What is the capital of France?": "paris",
    "What is 2 + 2?": "4",
    "What programming language are we using?": "python",
    # Add more questions as needed
}

score = 0

for question, correct_answer in questions.items():
    print(question)
    answer = input("Your answer: ").lower().strip()
    if answer == correct_answer:
        print("Correct!")
        score += 1
    else:
        print(f"Wrong! The correct answer is {correct_answer}.")

print(f"Game Over! Your final score is {score}/{len(questions)}")

Enhancements:

  • Add a timer to each question for extra challenge.
  • Include questions with multiple-choice answers and guide the players on how to select their answer (e.g., Type A, B, C, or D).
  • Customize the end message based on the player’s score (e.g., “Expert” for all correct answers, “Beginner” if less than half are correct).

Completion

At the end of the hackathon, each team should demonstrate their game by running it and explaining their code and any unique features they added. Encourage creativity in question themes, game mechanics, and additional Python features they might explore.

Tips for Success

  • Plan your game structure before you start coding.
  • Test each part of your game as you build it.
  • Work together and divide tasks based on each team member’s strengths.

This project encourages problem-solving, collaboration, and creativity, all within a fun and relatable context for young learners. It’s also scalable, allowing for more complex features like a graphical interface or a web version if teams are quick and eager to explore further.