QUESTION IMAGE
Question
in your guessing game, you replaced dashes in blanks when the user guessed a correct letter by using string slice. complete the code to replace the character with an index of n with the guessed letter? blanks = blanks:n + letter + ____ blanksn: blanksn+1 blanksn blanksn+1:
Step1: Understand string slicing
To replace a character at index n in a string, we need to take the part of the string before index n, the new character, and the part of the string after index n. The part before index n is blanks[:n], the new character is letter, and the part after index n should be all characters starting from n+1 which is represented as blanks[n+1:] in Python string slicing.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
D. blanks[n+1:]