← Back to Functions
Question 335
Repeat Word
Repeat Word
Write the body of repeat_word(word: str, times: int) -> None so it prints the word on its own line exactly times times using a while loop; when times is 0 it prints nothing. The driver reads a word and a count, calls the function and then prints Done; leave the driver as it is. Input: two lines, the word then an integer count, no prompts.
Expected Output:
hi hi hi Done
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Functions
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.