Python User Inputs
Table Of Contents:
- What Is User Input?
- How To Take User Input?
- Examples Of User Input.
(1) What Is User Input?
- As of now we have assigned the value to a variable directly inside the program like x = 10.
- Python allows user to assign value to a variable dynamically while your program is running.
- We can use python in built input() method to perform this operation.
(2) How To Take User Input?
- To take user input we have to show a input box to the user, so that they can enter there value.
- input() method allows us to do this operation.
Syntax:
input([prompt]) - where prompt is the string we wish to display on the screen. It is optional.
(3) Examples Of User Input?
Example-1
user_name = input('Enter Your User Name:') Output:
Enter Your User Name:Subrat Kumar Sahoo Example-2
password = input('Enter Your Password:') Output:
Enter Your Password:123456 
