what's the answer , guys ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what's the answer , guys ?

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

19th Jun 2022, 3:45 AM
Coco0o0
Coco0o0 - avatar
17 Answers
+ 1
#Get the string to repeat x = str(input()) #Store the variable into the result varuad stringLOL = "" #Get the number of times to repeat the string y = int(input()) #Repeat the string Y number of times for I in range(y): stringLOL+=x #Return the variable print(stringLOL) #finished
20th Jun 2022, 6:49 AM
Aarush Ishwar
+ 9
x = input () y = int(input()) print(x*y) This answer is very easy as well as recommended by most of the user
20th Jun 2022, 2:11 PM
I am offline
I am offline - avatar
+ 2
I think you are supposed to use the input() function for x and y x = input() y = int(input())
19th Jun 2022, 3:50 AM
Apollo-Roboto
Apollo-Roboto - avatar
+ 2
The answer may be x = str(input()) y = int(input()) Print(x*y)
20th Jun 2022, 1:37 PM
NARPAT AANJANA
NARPAT AANJANA - avatar
+ 1
x = str(input()) y = int(input()) rpt = x * y print(rpt)
20th Jun 2022, 8:58 AM
Aditya
Aditya - avatar
+ 1
x= str(input()) y= int(input()) res = x * y Print(res)
20th Jun 2022, 11:49 AM
Daniel Mirchev
Daniel Mirchev - avatar
+ 1
x=input() y=int(input()) print(x*y)
20th Jun 2022, 6:35 PM
Sirigiri Manohar Reddy
0
is this the answer ? x = "hi" y = 3 print (x*y)
19th Jun 2022, 3:48 AM
Coco0o0
Coco0o0 - avatar
0
so you mean the right answer is: x = input("hi") y = int(input(3)) print(x*y) is it like this ?!
19th Jun 2022, 4:10 AM
Coco0o0
Coco0o0 - avatar
0
Coco0o0 Yes but do not pass anything inside input function.
19th Jun 2022, 4:13 AM
A͢J
A͢J - avatar
0
why ?
19th Jun 2022, 4:14 AM
Coco0o0
Coco0o0 - avatar
0
Coco0o0 Why you should pass when you are taking user input?
19th Jun 2022, 4:24 AM
A͢J
A͢J - avatar
0
oh ... ok , thanks
19th Jun 2022, 4:26 AM
Coco0o0
Coco0o0 - avatar
0
Correct code: x = str(input()) y = int(input()) print(x*y) Hope this helps!
20th Jun 2022, 1:55 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
- 1
x = input() y = int(input()) print (x*y) Should work
20th Jun 2022, 11:42 AM
Umar Muhammad
Umar Muhammad - avatar
- 2
You could try this x=input() y=input() For i in range(3) Print(x, end=' ') and print(y, end=' ') I am so sure it's going to be the result you desired
20th Jun 2022, 8:50 AM
Abdulmuiz Akorede
Abdulmuiz Akorede - avatar
- 2
Hi everybody, Somebody can help me we some applications of Dev. I am a beginner...
20th Jun 2022, 2:47 PM
Jean-Arsène HOULA-HOULA
Jean-Arsène HOULA-HOULA - avatar