Ask Question
5 July, 13:42

Write code that prompts the user for a phrase and a number of times to repeat it, then prints the phrase that many times. Here is an example dialogue with the user: What is your phrase? His name is Robert Paulson How many times should I repeat it? 3 His name is Robert Paulson His name is Robert Paulson His name is Robert Paulson

+1
Answers (1)
  1. 5 July, 16:20
    0
    phrase=str (input ("Waht is your phrase?/n")) #prompting phrase.

    rep=int (input ("How many times should I repeat it?")) #prompting repetitions integer.

    print (phrase*rep) #printing the phrase.

    Output:-

    What is your phrase?

    My name is Mark.

    How many times should I repeat it?

    4

    My name is Mark. My name is Mark. My name is Mark. My name is Mark.

    Explanation:

    I have coded in python language. First I am prompting the phrase form the user in the variable phrase, then I am prompting the integer for repetitions in the variable name rep. Then printing the phrase for rep number of times.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write code that prompts the user for a phrase and a number of times to repeat it, then prints the phrase that many times. Here is an ...” in 📙 Social Studies if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers