+ 1
Somebody wrote code to take a string input and output it, repeated 10 times. However, the code results in an error.
Exercise: 14.4 I tried solving this problem but I couldn't get the output. Please help through this. Python program Input function x=input("Hello") y=int(input(10)) print(x*y)
8 Answers
+ 3
#try this then
x=input()
print(x*10)
0
Please post your attempt and tag the language you are using
0
I have updated it
0
Ok, so what this programme is ssying hello, and taking an input, and then saying ten and taking another input. Then it is pronting the first input as many times as the second inpuur is in value. If you want to do it ten times, just take out the line which defines y, and replace it with 10 in the third line. That will say print input 10 times.
Happy coding!
0
Can you please show me the code
0
I tried this. It shows me a error
0
1.
if you want repeat 10 times in a new line:
x = input()
for i in range(10):
print(x)
2.
if you want to repeat 10 times in the same line:
x = input()
print(x*10)
3.
if you want to repeat in the same line with the space between repeating string:
x = input()
print((x+' ')*10)
4.
if you want to get repeating number from user:
x, n = input(), int(input())
- 2
Sure:
x=input(âHelloâ)
print(x*10)