GETTING-INPUT-IN-PYTHON

Name=input()
Print(Name)
Output:
C:\python\python.exe E:\Learning\Python\sample_programs\basic.py
vijay
vijay


Its store all the data’s consider as a string data type.


Name=input("Enter Your Name :")
print(Name)


Output
Enter Your Name :vijay ramasamy
vijay ramasamy

I already told in input field all the datas are consider as a sting
So if I add 2 number and print the number meanse
Ex :
a=input("Enter A Value :")
b=("Enter B Value :")
c=a+b
print(c)


output:
Enter A Value :50
Enter B Value :150
50150

So we can add data type before getting input value like int , float ..Etc. means we can get a proper output
a=int(input("Enter A Value :"))
b=int(input("Enter B Value :"))
c=a+b
print(c)


Output
Enter A Value :50
Enter B Value :150
200


Get a multiple input value in single line
Split function to split the each input value using space between the variable values.
name1,name2,name3=input("Enter 3 Names : ").split()
print("Name 1 : ",name1)
print("Name 2 : ",name2)
print("Name 3 : ",name3)


Output
Enter 3 Names : Ram kumar siva
Name 1 : Ram
Name 2 : kumar
Name 3 : siva

Here we can split the each variable value using coma (,)
name1,name2,name3=input("Enter 3 Names : ").split(',')
print("Name 1 : ",name1)
print("Name 2 : ",name2)
print("Name 3 : ",name3)


Output
Enter 3 Names : Ram kumar,Sam kumar,siva kumar
Name 1 : Ram kumar
Name 2 : Sam kumar
Name 3 : siva kumar