Why is this not working: y = input ("What is your name") | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is this not working: y = input ("What is your name")

When I put in my answer, it brings out my answer with the input I put for it

27th Dec 2020, 9:40 PM
NDUBUISI PRINCE CHIMEREMEZE
6 Answers
+ 4
The argument for input function can be a string that will be printed out when the input is asked. If you store the value that the user writes and you passed that argument to input(), the variable will include both the argument and the input: x = input("what is your name?") >>>what is your name? Input is: >>>My name print(x) Output is: >>>what is your name?My name So if you separate the statements in a print("what is yourname?") and input() the user will see the same exact thing but the variable will only store the input of the user: print("What is your name") x = input() >>>What is your name? input is: >>>My name print(x) Output is: >>>My name
29th Dec 2020, 2:43 PM
Paula Campbell
Paula Campbell - avatar
+ 2
Try separating the two statements: print("What is your name?") y = input() Here, as there are both different statments, y variable will not include the what is your name, and the result is the same but it does what you want.
29th Dec 2020, 2:30 PM
Paula Campbell
Paula Campbell - avatar
+ 1
Kg thanks so much for the advice
29th Dec 2020, 2:50 PM
NDUBUISI PRINCE CHIMEREMEZE
+ 1
You are welcome! 😀😀😀
29th Dec 2020, 2:51 PM
Paula Campbell
Paula Campbell - avatar
0
Explain more please
29th Dec 2020, 2:31 PM
NDUBUISI PRINCE CHIMEREMEZE
0
👌 😊✌
29th Dec 2020, 3:02 PM
NDUBUISI PRINCE CHIMEREMEZE