introduction to python input python has two functions (see for discussion of functions in pythonthat can be used to get input directly from userinput and raw_input each takes string as an argument and displays it as prompt in the shell it then waits for the user to type somethingfollowed by hitting the enter key for raw_inputthe input line is treated as string and becomes the value returned by the functioninput treats the typed line as python expression and infers type in this bookwe use only raw_inputwhich is less likely to lead to programs that behave in unexpected ways consider the code name raw_input('enter your name'enter your namegeorge washington print 'are you really'name'?are you really george washington print 'are you really name '?are you really george washingtonnotice that the first print statement introduces blank before the "?it does this because when print is given multiple arguments it places blank space between the values associated with the arguments the second print statement uses concatenation to produce string that does not contain the superfluous blank and passes this as the only argument to print now considern raw_input('enter an int'enter an int print type(nnotice that the variable is bound to the str ' not the int sofor examplethe value of the expression * is ' rather than the good news is that whenever string is valid literal of some typea type conversion can be applied to it type conversions (also called type castsare used often in python code we use the name of type to convert values to that type sofor examplethe value of int(' ')* is when float is converted to an intthe number is truncated (not rounded) the value of int( is the int iteration generic iteration (also called loopingmechanism is depicted in figure like conditional statement it begins with test if the test evaluates to truethe program executes the loop body onceand then goes back to reevaluate the test this process is repeated until the test evaluates to falseafter which control passes to the code following the iteration statement python has only one commandinput somewhat confusinglypython ' input has the same semantics as raw_input in python go figure