ED
OV
PR
_AP
IA
UV
ST
, TABLE OF CONTENTS
Solutions Manual: Starting Out with Programming Logic and
ST
Design, 6th Edition
Author: Tony Gaddis
UV
Chapter 1. Introduction to Computers and Programming
Chapter 2. Input, Processing, and Output
Chapter 3. Decision Structures and Boolean Logic
Chapter 4. Repetition Structures
IA
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
Chapter 13. Recursion
PR
Chapter 14. Object-Oriented Programming
Chapter 15. GUI Applications and Event-Driven Programming
OV
ED
?
,ST
Part 1: Python Instructor Manual
UV
Part 2: Solutions to Programming
Exercises
IA_
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.
UV
Installing Python
The Python interpreter can run Python programs that are saved in files, or interactively
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.
I 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
Python runs in two modes: interactive and script mode. The labs will direct students to
PR
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.
3. Click Run and Run Module to see your program execute. The program will
execute in the Python Shell.
ED
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