In Python, it is possible to accept an input from keyboard using the input function.
Following is the syntax of the input function
input(“message”)
Return Input string
For example, now I am going to write a program to accept following inputs from the keyboard and display it to a useful information:
- First_Name
- Last_Name
- City
- State
Following is my script.
First_Name = input(“Enter Your first name”)
Last_Name = input(“Enter Your last name”)
City = input (“Enter you city of resident”)
State = input (“Enter you state of resident”)
1st : Allow user to enter the first name as stored in a variable called “First_Name”
2nd : Allow user to enter the last name as stored in a variable called “Last_Name”
3rd : Allow user to enter the city of resident as stored in a variable called “City”
4th: Allow user to enter the state of resident as stored in a variable called “State”
Following is the full script and result: