CJCoding With Joseph
15free / daySign inCreate account

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
Topics:
Functions
📥 Auto-Input:
hi\n3\n
This input is automatically fed to your program's stdin
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.