Some text in the Modal..

Some text in the Modal..

Python Tutorial: Python Input Command That You Want? | BJ Creations

Type something and hit enter

ads here
On
advertise here
Python Commands:

Python 3.6 uses the input() method.
Python 2.7 uses the raw_input() method.
The following example asks for the user's name, and when you entered the name, the name gets printed to the screen:

Python 3.6

print("Enter your name:")
x = input()
print("Hello ", x)

Python 2.7

print("Enter your name:")
x = raw_input()
print("Hello ", x)
Save this file as demo_string_input.py, and load it through the command line:
C:\Users\Your Name>python demo_string_input.py
Our program will prompt the user for a string:
Enter your name:
The user now enters a name:
Linus
Then, the program prints it to screen with a little message:
Hello, Linus

Click to comment