I am interested in multiplying all the numbers in a Python string by a variable (y) as in the following example where y = 10.
Initial Input:
"I have 15, 7, and 350 cars, boats and bikes, respectively, in my parking lot."
Desired Output:
"I have 150, 70, and 3500 cars, boats and bikes, respectively, in my parking lot."
I tried the following Python code, but am not getting the desired output. How can I create the desired output in Python code?
string_init = "I have 15, 7, and 350 cars, boats and bikes, respectively, in my parking lot."
string_split = string.split()
y = 10
multiply_string = string * (y)
print(multiply_string)