Python Tutorial

Here you can learn about the basics of Python for free.

Saturday, June 8, 2019

Input( ) function





In python , to get input from the user interactively , you can use function input( ).
It is used in the following manner.
 
variable_to_hold_the_value=input(<prompt to be displayed>)

For example:-
name=input("What is your name ?")

shows output as--
in front of which you can type  the name .like as----
↳As you can see that the value getting from input function is string type:::
↪so to convert it into integer, we use int() function:::
as,,
a=int(input('Enter the number:'))
↳to convert it into float value(decimal ) , we use float() function:::
a=float(input('enter the decimal number'))