python command line string input | ectech

Share:

Command-line String Input

Python allows for command line input.
That means we are able to ask the user for input.
The following example asks for the user's name, then, by using the input() method, the program prints the name to the screen:

Example

demo_string_input.py
print("Enter your name:")
x = input()
print("Hello, " + x)

No comments