User input | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

User input

Can someone help me understand this? I keep assigning a input but it keeping outputting it twice. I have reached the 16.2 questions and regardless of my input the output keeps coming back with other wording. Write a program that takes the text as input and outputs it by adding 3 stars at the beginning and the end. Sample Input this is awesome Sample Output *** this is awesome *** Every time I attempt my code the word hello is inputted also even though itā€™s not put in

21st Sep 2021, 3:34 PM
Victoria Dunnaway
18 Respostas
+ 6
Victoria Thomas , if you use the code done by Jotin Rai , you can not pass the test cases because: (the code itself has no issue, but it is not conform with the task description) a = input("Plzz enter some text") print("ā˜…ā˜…ā˜…",a,"ā˜…ā˜…ā˜…") ā–ŖļøŽinput has an argument, which is not allowed in code coach exercises ā–ŖļøŽthe code uses some special stars for output, and therefore will also fail with the test cases try this: ā–ŖļøŽremove everything inside the parenthesis of the input() function: a = input() ā–ŖļøŽreplace the special stars by this: '***' happy coding and good success!
23rd Sep 2021, 2:36 PM
Lothar
Lothar - avatar
+ 5
Victoria Thomas , the code works as expected. if you input "Tom" as name, the screen will show: Enter your name: Tom Hello, Tom the first line is the user prompt and what you have typed in, the second line is the output. this is when the code is executed in a external IDE. in sololearn the output is different: Enter your name: Hello, Tom this is caused by the way playground is working
21st Sep 2021, 3:57 PM
Lothar
Lothar - avatar
+ 4
Cholohatwhite , please do not post irrelevant content here. your post has no relation to the question, and can be considered as spam. thanks for your understanding!
23rd Sep 2021, 3:51 PM
Lothar
Lothar - avatar
+ 2
Simply input function prints your argument then waiting enter key to be pressed then read what user was typed until '\n' in other word ( enter key ) and return you back with user input if you miss some thing, mention me
21st Sep 2021, 4:25 PM
Kyrillos Akram
Kyrillos Akram - avatar
+ 2
name = input() print(f"Hello, {name.title()}")
22nd Sep 2021, 11:26 PM
Dark Hunter
Dark Hunter - avatar
+ 2
Easiest Way: text=input() print(f"*** {text} ***")
25th Sep 2021, 4:34 AM
Sancho Godinho
Sancho Godinho - avatar
+ 1
Lothar & Kyrillos Akram , The 16.2 exercise in Python isnt giving me these result. The results keep showing different words than the ones i am using
21st Sep 2021, 6:46 PM
Victoria Dunnaway
+ 1
Hi Victoria! Did you try something else? name = input() print("Hello, "+name) But for me, 16.2 shows a different challenge.
22nd Sep 2021, 1:59 AM
Python Learner
Python Learner - avatar
+ 1
Hi JUMP_LINK__&&__Python__&&__JUMP_LINK Learner Thats just the example i posted because the challenge is confusing me. It saying to use the format of the example to create ***this is awesome*** symbols included but when i use the formula given in the example my answers come back with the word hello and i didnt even type in hello.
22nd Sep 2021, 3:37 AM
Victoria Dunnaway
+ 1
Will u share your code link so that we can tell your mistakes
22nd Sep 2021, 3:42 AM
Pariket Thakur
Pariket Thakur - avatar
+ 1
22nd Sep 2021, 4:10 AM
Jotin Rai
Jotin Rai - avatar
+ 1
Hiii
22nd Sep 2021, 4:20 AM
narender gill nandu gill saab ji
+ 1
Jotin Rai Time Is Money I tried that input and it keeps says that other words i didnt use are being inputted https://sololearn.com/coach/1033/?ref=app
22nd Sep 2021, 4:28 AM
Victoria Dunnaway
+ 1
Share your code
22nd Sep 2021, 8:40 AM
Pariket Thakur
Pariket Thakur - avatar
+ 1
Time Is Money My code is what was suggested by Jotin Rai. I canā€™t share what was ran since itā€™s a challenge. When what he suggested is ran no matter what is put in that sequencer extra wording of hello is added. Nothing is wrong with the code i need to figure out why the extra wording is showing
22nd Sep 2021, 10:08 AM
Victoria Dunnaway
+ 1
Lothar Thank you! This solution worked.
23rd Sep 2021, 3:34 PM
Victoria Dunnaway
0
def printBill(text): print("======") print(text) print("======") printBill(input()) done...!
6th Mar 2022, 2:40 PM
Nikhila
- 1
sure! the answer is: a=input("Tu nombre >") print( f " hello! welcome {a} nice day! " ) output: hello! welcome cholohatwhite nice day!
23rd Sep 2021, 2:40 PM
Cholohatwhite
Cholohatwhite - avatar