Avatar ·

How to make a program that repeats text as many times as the user requested? [closed]

📁 question, example, AI

. This question is not accepting answers at this time.

 

Homework questions are allowed only if you have attempted to solve them yourself before asking. Please edit the question and indicate what exactly caused you difficulties when solving the problem. For example, provide the code you wrote while trying to solve the task

Closed 4 years ago.

For example, the text "Hello World!". The user entered the number 5, and "Hello World!" was displayed 5 times. Entered 10, displayed 10 times. Thanks in advance.

Avatar ·

For Python 3.6+:

data = ('2020-08-02', '00:00', 'A', 'B', 'C')res = (f""{data[0]} {data[1]}"",) + data[2:]

result:

In [121]: resOut[121]: ('2020-08-02 00:00', 'A', 'B', 'C')

Log in to leave an answer

Blogs