Question: This is the recursive function I have. (PYTHON) It is supposed to return None and print the answer on screen, which i dont know how
This is the recursive function I have. (PYTHON)
It is supposed to return None and print the answer on screen, which i dont know how to do. I know my code is correct except for it doesnt return none and doesnt print.
def update_dashes(secret, dashes, guess): if guess not in secret: return dashes else: if secret == '': return '' elif secret[0] == guess: return guess + update_dashes(secret[1:], dashes[1:], guess) return dashes[0] + update_dashes(secret[1:], dashes[1:], guess)
So basically this is a hangman game. guess is a one letter string. dashes and secret have equal length. if guess is in secret, the dashes are replaced by the guess.
Just fix my code please
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
