← Back to challenges

Repeat String

PythonMediumstringsconditionslogiclanguage_fundamentals

Instructions

Create a function that takes a string txt and a number n and returns the repeated string n number of times.

If given argument txt is not a string, return Not A String !!

Examples

repeat_string("Mubashir", 2) ➞ "MubashirMubashir"

repeat_string("Matt", 3) ➞ "MattMattMatt"

repeat_string(1990, 7) ➞ "Not A String !!"
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: City School Creating IDS