How to take input from the user?

How to take input from the user?

1 Like

Hi, in data-science it is very rare to take input from user, but if you are onto for making python programs, you can use “input”, more details you can find on -


there is an inbuilt functions in python i.e.
" input()" is used to take input from the users

a = input(“Enter Any question”) //this is type of string.

If you want to take input in form of integer you can use the int() method.
b = int(input(""Enter The number))
The b variable will be of the integer type.
same goes for float as well you have to use float() method.

a_number =int(input( )) … for integers
a_number = float(input( ))…floating values

as by default it will assume as a string so we have to define it for any integer value if we are working on the integers or floats if we use them