Python Input function | SoloLearn: Learn to code for FREE!

+6

Python Input function

>>> input("Enter something please: ") Enter something please: This is what\nthe user enters! 'This is what\\nthe user enters!' I tried to follow this sample from the Python 3 course and tried it at the code playground features, where in the syntax it is written: s=input("Enter something please:") print(s) and I filled in : s=input("Enter something please: Learning Pyhton is fun") print(s) but then the output for this codework displayed: Enter something please: Learning Python is fun how to get rid of the function "Enter something please"? Just as it is shown in the example course I attached above. Thanks for helping.

12/8/2018 1:22:10 PM

Gary Jovan

5 Answers

New Answer

+10

Actually, no need to write it. You can simply write: a=int(input()) print (a)

+11

In the input function, there is a variable parameter called "end". For example : variable = input("Enter something please : ", end="\n") print(variable)

+1

You have to know why the tutorial told you to put it there in the first place. Because you cannot test how a real Python code works in code playground. The string in input is normally displayed to hint the user what to input and it is a good habit to include it.

+1

a = int (input()) This is get a integer and if u print this show to u integer a=str(input()) This get a string and if u print this show to u string And if u want dont input u can just print This way: print("hello python is fun") Or this way : "python is fun"

-3