Raw_Input and Input

There are two functions in Python that you can use to read data from the user: raw_input and input.  You can store the results from them into a variable.


raw_input is used to read text (strings) from the user:
name = raw_input("What is your name? ")

What is your name? spilcm
type 'str'>


input is used to read integers
age = input("What is your age? ")
print "Your age is: ", age

What is your age? 100
Your age is: 100
type 'int'>


Leave a Reply

Your email address will not be published. Required fields are marked *