Ask Question
9 September, 21:37

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

+3
Answers (1)
  1. 9 September, 23:39
    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?
Find 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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers