0

Can you help on Working with input?

Write a program to take x and y as input and output the string x, repeated y times. Sample Input hi 3 Sample Output hihihi Remember to convert the input to the required data type. Here is my attempt: x = 5 y = input() print(x * y) (x * y) Ps:when i run the code there were test cases 1 to 4 both 3 and 4 were hidden but 1 and 2 were not

16th Nov 2021, 8:03 AM
Shah Johan
7 ответов
+ 6
You are taking input for string but not for repeated times. Take input to 'x' also.. edit: also convert second input to int type as int(input()) Shah Johan
16th Nov 2021, 8:07 AM
Jayakrishna 🇮🇳
+ 6
Shah Johan Well done! You might like to let Jayakrishna🇮🇳 know that you have solved the problem. Was he able to help you?
16th Nov 2021, 9:38 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Test cases #1 and #2 keeps ticking whenever i change x = 5 to x = 2(#1) x = 8(#2)
16th Nov 2021, 8:07 AM
Shah Johan
+ 2
No. You have to take input number , not your manual input.. Shah Johan y = int( input() ) first input is string second input is a number
16th Nov 2021, 8:11 AM
Jayakrishna 🇮🇳
+ 2
Shah Johan string_input = input() integer_input = int(input()) Now you need to print the output of string_input * integer_input Read through Jayakrishna🇮🇳 answers again and see if you can fix your code
16th Nov 2021, 9:33 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
Rik Wittkopp I already fix my code thanks btw
16th Nov 2021, 9:37 AM
Shah Johan
+ 1
Same problem here, how did you solve that? Shah Johan
19th Oct 2022, 12:28 PM
Marco Grotto
Marco Grotto - avatar