Python OOPs


Python SQLite


Examples


Others


Python input() Function


In Python,we can take input from user using input() function. The input() function converts the input into a string. If we enter an integer value input function converts into string.

Take input from user

Example
name=input("Enter Your Name : ")
print("Hi, "+name)
Output
Enter Your Name : Tom
Hi, Tom

Accept an Integer input from User

Example
a=int(input("Enter Number 1: "))
b=int(input("Enter Number 2: "))
c=a+b
print("Total : "+str(c))
Output
Enter Number 1: 50
Enter Number 2: 25
Total : 75

Accept a Float input from User

Example
a=float(input("Enter Number 1: "))
b=float(input("Enter Number 2: "))
c=a+b
print("Total : "+str(c))
Output
Enter Number 1: 10.5
Enter Number 2: 5.5
Total : 16