import random # READING QUEST # A simple educational reading game levels = [ { "name": "Beginner Reader", "story": ( "The cat sat on a mat. " "The cat saw a little bird." ), "questions": [ { "question": "Where did the cat sit?", "options": ["A. A chair", "B. A mat", "C. A tree"], "answer": "B", "explanation": "The story says the cat sat on a mat." }, { "question": "What animal did the cat see?", "options": ["A. A dog", "B. A fish", "C. A bird"], "answer": "C", "explanation": "The cat saw a little bird." } ] }, { "name": "Story Explorer", "story": ( "Maya planted a seed in her garden. " "She watered it every morning. " "After many days, a green plant appeared." ), "questions": [ { "question": "What did Maya plant?", "options": ["A. A seed", "B. A stone", "C. A flower"], "answer": "A", "explanation": "Maya planted a seed." }, { "question": "When did Maya water the seed?", "options": [ "A. Every night", "B. Every morning", "C. Every week" ], "answer": "B", "explanation": "She watered it every morning." }, { "question": "What appeared after many days?", "options": [ "A. A bird", "B. A new house", "C. A green plant" ], "answer": "C", "explanation": "A green plant appeared." } ] } ] def show_progress(score, total): print(f"\n⭐ Score: {score}/{total}") def play_level(level, total_score): score = 0 lives = 3 print("\n" + "=" * 40) print(f"LEVEL: {level['name']}") print("=" * 40) print("\nšŸ“– READ THIS STORY:\n") print(level["story"]) input("\nPress Enter when you are ready to answer...") questions = level["questions"].copy() random.shuffle(questions) for item in questions: if lives == 0: print("\nYou have used all your lives!") break print("\n" + item["question"]) for option in item["options"]: print(option) choice = input("Your answer (A, B, or C): ").strip().upper() while choice not in ("A", "B", "C"): choice = input( "Please enter A, B, or C: " ).strip().upper() if choice == item["answer"]: print("Correct! 🌟 Well done!") score += 10 else: lives -= 1 print("Not quite! ā¤ļø") print("Hint:", item["explanation"]) print(f"Lives remaining: {lives}") total_score += score print("\nLevel complete!") show_progress(score, len(level["questions"]) * 10) print(f"šŸ† Total points: {total_score}") return total_score, lives def main(): print("šŸŽ® WELCOME TO READING QUEST!") player = input("What is your name? ").strip() if not player: player = "Reader" total_score = 0 print(f"\nWelcome, {player}! Let's improve your reading.") for index, level in enumerate(levels): total_score, lives = play_level(level, total_score) if lives == 0: print("\nGame over! Keep practising and try again.") break if index < len(levels) - 1: print("\nšŸ”“ Great job! The next level is unlocked.") input("Press Enter to continue...") print("\n" + "=" * 40) print(f"Thanks for playing, {player}!") print(f"FINAL SCORE: {total_score} points") print("Keep reading and keep learning! šŸ“š") print("=" * 40) if __name__ == "__main__": main() Hello, world

Hello, world.