Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Difference between Input and raw_input in python

    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 434
    Comment on it

    input : Reads a number from user input.You can assign (store) the result of input into a variable.
    Example:

    age = input("How old are you? ")
        print type(age) 
        print "Your age is", age
        print "You have", 65 - age, "years until retirement"
    raw_input : Reads a string of text from user input.
    name = raw_input("What's yer name? ")
        print name, "... what a silly name!"
        Output: Howdy, pardner. What's yer name? Paris Hilton
        Paris Hilton ... what a silly name!

 1 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: