Exercise: Repetition and Concatenation
Let's convert integers to strings and repeat their instances.
We'll cover the following
Problem Statement
In this exercise, you must implement the rep_cat
function. You are given two integers, x
and y
, as arguments. You must convert them into strings. The string value of x
must be repeated 10
times and the string value of y
must be repeated 5
times.
At the end, y
will be concatenated to x
and the resulting string must returned.
Sample Input
x = 3
y = 4
Sample Output
'333333333344444'
Coding Challenge
Take some time to figure out the logic behind this problem before jumping to the implementation. The function skeleton has been created. You only need to write code in its body.
The pass
statement can be erased and replaced with your return
statement.
If you get stuck, feel free to check out the solution review in the next lesson.
Good luck!
Get hands-on with 1200+ tech skills courses.