how to take input in python using this IDE??
Taking input in python
Hello @kartik56,
Python provides us with two inbuilt functions to read the input from the keyboard.
- raw_input ( prompt )
- input ( prompt )
raw_input ( ): This function works in older version (like Python 2.x). This function takes exactly what is typed from the keyboard, convert it to string and then return it to the variable in which we want to store. For example –
g = raw_input("Enter your name : ")
print(g)
input (): This function first takes the input from the user and then evaluates the expression, which means Python automatically identifies whether the user entered a string or a number or list. If the input provided is not correct then either syntax error or exception is raised by python. For example –
val = input("Enter your value: ")
print(val)
Note: You need to explicitly convert it into an integer in your code using typecasting if you want to an integer.
Hope, this would help.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.