FIGURE 4.5 The complete script0402.py output.
Run this script as many times as you want. Experiment with the various types of answers you put in
and see what the results are. Also try making some minor modifications to the script and see what
happens. Experimenting and playing with your Python script will enhance your learning.
Summary
In this hour, you got a wonderful overview of Python basics. You learned about output and formatting
output from Python; creating legal variable names and assigning values to variables; and various data
types and when they are assigned by Python. You explored how Python can handle input from the
keyboard and how to convert the data types of the variables receiving that input. Finally, you got to
play with your first Python script. In Hour 5, your Python exploration will continue as you delve into
mathematical algorithms with Python.
Q&A
Q. Can I do any other kind of output formatting besides what I learned about in this
chapter?
A. Yes, you can also use the format function, which is covered in Hour 5.
Q. Which is better to use with a print function, double quotes or single quotes?
A. Neither one is better than the other. Which one you use is a personal preference. However,
whichever one you choose, it’s best to consistently stick with it.
Q. Bottles of tea on the wall?!
A. This is a family-friendly book. Feel free to modify your answers to script0402.py to
your liking.