Taking input from user - Coders PlayGround

Learn to code and change the future!

Sunday, 14 October 2018

Taking input from user

Hello friends. Let us learn how to take input from user and displaying it on screen.



In Python 2 version, input is taken using "raw_input".

For example:
name = raw_input("Enter your name:   ")



But this has changed in Python 3 version. We use "input"  instead of "raw_input"
Let us look at an example which demonstrates the usage of input command in Python 3


#A program to take input

name = input("Enter your name:   ")

roll_no = input("Enter your roll no:   ")

print("Your name is ", name, "Your roll no is: ", roll_no)


Python Program: Input example















PropellerAds