MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / choose_difficulty

Function choose_difficulty

projects/Hangman/main.py:127–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

125
126
127def 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
143def play(word, initial_tries):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected