/
dashytka
/
Magic-Word-Guesser
Обзор
Документация
Войти
/
dashytka
/
Magic-Word-Guesser
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
python
55 строк
2 KB
dashytka
create python
19 ноя 2025, 16:50
19 ноя 2025, 16:50
4e4e386
Код
Авторство
О чём код?
# Magic Word Guesser import random import time class MindReader: def __init__(self): self.words = ["sunshine", "mountain", "butterfly", "adventure", "mystery", "whisper", "universe", "fantasy", "serenity", "wonder"] self.magic_symbols = ["✨", "🌟", "🔮", "⭐", "💫"] def animate_loading(self, message, duration=2): print(f"\n{message}", end="") for _ in range(3): print(".", end="", flush=True) time.sleep(0.5) print() def start_magic_session(self): print("🔮 Welcome to the Magic Word Guesser!") print("Think of any word in your mind...") time.sleep(2) # "Reading user's mind" self.animate_loading("Reading your thoughts") # Select random word and symbols chosen_word = random.choice(self.words) magic_symbol = random.choice(self.magic_symbols) # Dramatic reveal print(f"\n{magic_symbol} The word in your mind is...") time.sleep(2) print(f"✨ {chosen_word.upper()}! ✨") # Ask if correct response = input("\nWas I correct? (yes/no): ").lower() if response in ['yes', 'y']: print("🎉 Amazing! The magic works!") else: print("😊 The magic is still learning... Let's try again!") return chosen_word # Create and run the magic session if __name__ == "__main__": wizard = MindReader() while True: wizard.start_magic_session() play_again = input("\nWould you like to play again? (yes/no): ").lower() if play_again not in ['yes', 'y']: print("Thanks for playing! Until next time! 👋") break