ED
OV
PR
AP
A?_
UVI
ST
, TABLE OF CONTENTS
Solutions Manual: Starting Out with Programming Logic and
Design, 6th Edition
ST
Author: Tony Gaddis
U
Chapter 1. Introduction to Computers and Programming
Chapter 2. Input, Processing, and Output
VI
Chapter 3. Decision Structures and Boolean Logic
Chapter 4. Repetition Structures
A
Chapter 5. Modules
Chapter 6. Functions
?_
Chapter 7. Input Validation
Chapter 8. Arrays
Chapter 9. Sorting and Searching Arrays
AP
Chapter 10. Files
Chapter 11. Menu-Driven Programs
Chapter 12. Text Processing
PR
Chapter 13. Recursion
Chapter 14. Object-Oriented Programming
Chapter 15. GUI Applications and Event-Driven Programming
OV
ED
??
,ST
Part 1: Python Instructor Manual
U
Part 2: Solutions to Programming
VI
Exercises
A
Part 3: Language Companions
?_
Part 4: Answers to Review Questions
AP
PR
OV
ED
? ?
, Solutions Manual Part 1
Python Instructor Manual 1
Python Instructor Manual
Lab 1: Input, Processing, and Output
ST
What is Python?
Python is a general purpose language created in the early 1990s. It has become popular
in business and academic applications.
U
Installing Python
The Python interpreter can run Python programs that are saved in files, or interactively
VI
execute Python statements that are typed at the keyboard. Python comes with a program
named IDLE that simplifies the process of writing, executing, and testing programs. The
labs primarily use the IDLE environment.
A
The most current version of Python can be downloaded from the following site:
http://www.python.org/download/releases/. After downloading and installing, start the
?_
IDLE Environment for Python.
If the Edit window for entering code does not come up, go to Options, Configure IDLE,
click on the General tab, and under Startup Preferences select Open Edit Window. Close
AP
and reopen the Environment. You should only have to do this the first time running
Python.
Python Scripts
PR
Python runs in two modes: interactive and script mode. The labs will direct students to
use script mode, in which the interpreter reads the contents of a file that contains Python
statements. The statements are created and saved in a file with a .py extension.
Using the IDLE
OV
1. In the Edit window of Python, start by saving your file. You must add the .py
extension along with your file name. Doing so makes your program ready for
compiling and also identifies keywords.
2. After entering code, you can check your code by clicking Run and Check Module.
ED
3. Click Run and Run Module to see your program execute. The program will
execute in the Python Shell.
The Print Function
?
To print something onto the screen, use the print function. Anything in single
quotation marks is printed to the screen. If the value of a variable needs to be displayed,
?
you can simply list the variable name. If a string literal also needs to be displayed, you
can separate the message and variable name with commas. Double quotation marks can