How to Take Python User Input

Now we see how to take Python user input from input() function means we can print text or message such as we can ask from user that please enter your user name and that we can print it on screen using print() function see below how we can do it :

Note: there are two version like Python 3.6 and Python 2.7 uses input() and raw_input()

Python User Input

How we can take user input in Python 3.6

username = input("Enter username:")
print("Username is: " + username)

Output

Enter username:usman
Username is: usman

How we can take user input in Python 2.7

username = raw_input("Enter username:")
print("Username is: " + username)

Output

Enter username:usman
Username is: usman

Note: Python stops executing our code when it comes to the input() function, and continues when the user has given some input.

If you still have any problem or a query, you can ask and comment below the post feel free to contact me without any hesitation.

Visit my Website to Learn more about Python

Link: https://Codelikechamp.com

You can also follow me on Medium and Linkedin, Where i also share such amazing information just for you it is free so let’s study together.

Medium Link: Follow me on Medium

Linkedin Link: Follow me on Linkedin

🤞 Don’t miss any latest posts!

Please subscribe by joining our community for free and stay updated!!!

IF YOU HAVE ALREADY SUBSCRIBED JUST CLOSE THIS FORM !

1 thought on “How to Take Python User Input”

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top