How to get input from user in python
![How to get input from user in python](https://pythonpoint.net/wp-content/uploads/2020/11/How-to-convert-string-to-int-in-python-2-1024x576.jpg)
Python has an input function to accept inputs from the user. Python 2 uses raw_input(prompt) function whereas python 3 uses input(prompt).
prompt- a string, representing a default message before the input. This is not necessary.
a=input()
![](https://pythonpoint.net/wp-content/uploads/2020/11/Screenshot-2020-11-12-064213.jpg)
Input function will convert whatever you enter as input to string. We need to explicitly convert it into required data type using typecasting
![](https://pythonpoint.net/wp-content/uploads/2020/11/Screenshot-2020-11-12-064407.jpg)
Subscribe
Login
Please login to comment
0 Discussion