()
| 125 | |
| 126 | |
| 127 | def choose_difficulty(): |
| 128 | global DIFFICULTY_LEVEL |
| 129 | DIFFICULTY_LEVEL = input("Choose difficulty level (easy, medium, hard): ").lower() |
| 130 | if DIFFICULTY_LEVEL == "easy": |
| 131 | return ( |
| 132 | 8 # we can adjust the number of initial guesses for each difficulty level |
| 133 | ) |
| 134 | elif DIFFICULTY_LEVEL == "medium": |
| 135 | return 6 |
| 136 | elif DIFFICULTY_LEVEL == "hard": |
| 137 | return 4 |
| 138 | else: |
| 139 | print("Invalid difficulty level. Defaulting to medium.") |
| 140 | return 6 |
| 141 | |
| 142 | |
| 143 | def play(word, initial_tries): |