# We just saw a Python program file named types.py. That is a Python # script file. # If you run that script in script mode, i.e., run it like this: # # alee$ python types.py # # it will run fine, but you won't see any output on your screen. # We can change that by using the 'print' command in Python. # This time run this program (print.py) in script mode, like this: # # alee$ python print.py # # and see what you get on the screen. 3 + 4 + 2 # Line 1 print 4 + 8 # Line 2 # The python interpreter in script mode will evaluate each line of your # program (script) and do exactly what you asked it to do. # Line 1 above tells the interpreter to evaluate the expression (3 + 4 + 2) # and do nothing else. So, it will evaluate it and produce 9 and that is # all it does. # Line 2 tells the interpreter to evaluate the expression (4 + 8) and # print it to the standard output device, which is your compter screen. # I will prepare script files with the print command sprinkled here and # there if it would make the program easier to understand when you run it. # You might wonder what is goind on in an interactive mode as in ipython. # When Python runs in an interactive mode, the interpreter works a little # differently in that it interprets line and furthermore prints the result # to the screen which makes sense since you are sitting there to see the # result. When you are in script mode, most likely you will write a # series of lines of code and many of those lines will be for some # intermediate steps of your program. You wouldn't want to see the # values of each line printed on the screen. That will be too confusing.