0

Don't understad test case multiply variables

Hello! I havet a problem test case #1 & #2 in multiply variables. Test case #1 is input 1: hi, and input 2: 5. And the output should be hihihihihi. So I wrote x = "hi" y = int("5") print(y*x) No problems there, in test case #2 is input 1: python and input 2: 3. And the output should be pythonpythonpythonpython. So I wrote: x = "hi" y = int("5") print(y*x) x = "python" y = int("3") print (x*y) But then the answere is: hihihihihi pythonpythonpythonpython And I get wrong answere on both test cases. So to my question, how do I sepperate thise two so I get right on both?

8th Sep 2020, 4:50 AM
Robin Johansson
Robin Johansson - avatar
3 Answers
+ 1
You have take two input, first one string input and the other one integer input and assign it to two variable then multiply the string input with integer input and print it. Try this one: string = input() num_to_multiply = int(input()) result = string * num_to_multiply print(result)
8th Sep 2020, 4:56 AM
Maharnab Saikia
Maharnab Saikia - avatar
+ 1
Go through this to understand input function 👇 https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2426/
8th Sep 2020, 5:03 AM
Maharnab Saikia
Maharnab Saikia - avatar
+ 1
Thanks a ton!! And thanks for the link!
8th Sep 2020, 5:24 AM
Robin Johansson
Robin Johansson - avatar