December 2000
Intermediate to advanced
816 pages
16h 57m
English
2-1. Variables, print, and the string format operator. Start the interactive interpreter. Assign values to some variables (strings, numbers, etc.) and display them within the interpreter by typing their names. Also try doing the same thing with the print statement. What is the difference between giving just a variable name versus using it in conjunction with print? Also try using the string format operator ( % ) to become familiar with it.
2-2. Program output. Take a look at the following Python script:
#!/usr/bin/env python 1 + 2 * 4(a) What do you think this script does?
(b) What do you think this script will output?
(c) Type the code in as a script program and execute it. Did it do what you expected? Why or why not?
(d) How does ...
Read now
Unlock full access