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()
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
This post was a breath of fresh air. Thank you for your unique insights!