+ 1
why is the 'input' keyword taking only the first word?
s= input("enter something:") print(s) i gave the input as 'good morning' n the output i am getting is 'good'. the second word after space is not displayed.
16 Respuestas
+ 1
try the following code
s = str(input("enter your word:"))
print(s)
you need to convert the input type as str inorder to print it as plain text
0
m not using the quotes.
0
Sundar is correct
0
while giving input itself we need to convert it's type as string it's good programming practice
thanks @isk
0
its not working sundar :/
whatever is written inside the double quotes is printed properly but while taking input from the user its taking only the first word.
0
That's weird? It's working for me.
0
s = str(input(""))
print(s)
this was the code. when i run the program, it says user input required, so i typed good morning. but it outputs only good. the second word is not printed. y??
0
Priyanka can you show me the error it's throwing
0
its not throwing any error. it is just not printing anything after the first word.
0
wats your python version
0
3
0
The issue you are telling is weird. what's the ide you use. it's working fine with default python ide IDLE
0
ya its working gud on IDLE but y not on the "code playground" of this app
0
Yes Priyanka you are right. coding playground and few other interactive fiddles are not giving the desired output in certain cases like this. It might be problem with the simulator.
0
ok ty sundar! and i am pavithra not priyanka :p
0
oops sorry typo and dictionary :-) :-p