Taking input from console in Python

PythonServer Side ProgrammingProgramming

In this tutorial, we are going to learn how to take input from the console in Python.

The interactive shell in Python is treated as a console. We can take the user entered data the console using input() function.

Example

# taking input from the user
a = input()
# printing the data
print("User data:-", a)
Tutorialspoint
User data:- Tutorialspoint

Output

If you run the above code, then you will get the following result.

Tutorialspoint
User data:- Tutorialspoint

Conclusion

The data that is entered by the user will be in the string format. If you have any doubts in the tutorial, mention them in the comment section.

raja
Published on 11-Jul-2020 11:40:52
Advertisements