+ 1
Can you help me on Input?
Somebody wrote code to take a string input and output it, repeated 10 times. However, the code results in an error. Fix the code to output the desired output. Here is my attempt: x = input('hello') print('hello'+10) ('hello'+10)
9 odpowiedzi
+ 3
Shah Johan
You need to take user input instead of writing Hard Code value because for different inputs output maybe different.
do print(x * 10) #where x is input
https://www.sololearn.com/post/1159836/?ref=app
+ 13
Shah Johan ,
you have joined sololearn just some days ago. and you have not really started with learning from a tutorial. may be you have learned a bit somewhere else.
to get successful here in sololearn (and in coding in general) you should focus on one programming language first. if it is python, start with "python for beginners".
learn from the tutorial, do the questions and exercises, and practice as much as you can afford. try to solve simple tasks so that you get more and more experience.
do not move on too fast, go a pace that is suitable for you. it is more important to grow the knowledge than to grow the xp's.
if you get stuck somewhere you can place a question in q&a section to get help.
happy coding and good success!
+ 5
There are alot of errors in your code
1.The last line of your code is not supposed to be there because it is incomplete
2. An int can't be added to a string(convert 10 to a string str(9), or you can use string formating) print(f"hello {9})
3 And you have missed the multiplication symbol print("hello" +str(10)*10)
+ 1
Shah Johan
First mistake you have passed an argument in input function which is wrong.
2nd mistake we have to print input multiple times so in this case we have to multiply instead of adding.
+ 1
x = input('hello\n' *10)
print(x)
or
x = input('hello'*10)
print(x)
0
print('hello'*10)
('hello'*10)
I tried this it works but it said to try again
Expected output:hellohellohellohellohellohellohellohellohellohello
My output:same as the expected output
0
Whatever we passed as a string into the input like:
input('enter name: ')
or
input("enter name: ")
It shows as a prompt message in the output...
So,
x = input('hello') will output hello as a prompt message... And there would be an input stream where you input value/string you want multiplied...
Then it will be stored in variable x
Remember input() ALWAYS returns string...
Only
x=input()
will let you enter whatever you want to be used by your program... Just that there would be no prompt message...
0
Try this
X = input("hello)
Print(X * 10)