Python Input function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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.

8th Dec 2018, 1:22 PM
Gary Jovan
Gary Jovan - avatar
5 Answers
+ 11
Actually, no need to write it. You can simply write: a=int(input()) print (a)
8th Dec 2018, 1:24 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 11
In the input function, there is a variable parameter called "end". For example : variable = input("Enter something please : ", end="\n") print(variable)
8th Dec 2018, 1:37 PM
program - avatar
+ 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.
10th Dec 2018, 4:16 AM
Gordon - avatar
+ 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"
10th Dec 2018, 4:27 AM
Ali Mohammady
Ali Mohammady - avatar
- 5
9th Dec 2018, 2:50 PM
Sajjad - avatar