Given 2 inputs, a string and a decimal number, output the string multiplied by that number.
The catch is that the number can be a float or an integer.
You should output the string
floor(n) time and then the first
floor((n-floor(n))*len(string)) letters again.
- The input will not always be a float, it may be an int. So 1.5, 1, and 1.0 are all possible. It will always be in base 10 though, and if you wish an exception please comment.
- The string input may contain whitespace, quotes and other characters. No newlines or control chars though.
- No built-ins for direct string repeating, even string multiplication like the python
'a'*5are allowed. However string addition is allowed.
The comma & space separate the inputs.
test case, 1 -> test case case, 2.5 -> casecaseca (will add more later), 0.3333 -> (will(space) cats >= dogs, 0.5 -> cats >
I am seeing a lot of answers that use builtin string multiplication or repeation functions. This is not allowed. @VTC's answer is valid though, because it does not multiply the string, only the float input. So the definitive rule is: If it directly multiplies the string, you can't do it.