IT 117: Intermediate Scripting
Class 3

Today's Topics

Tips and Examples

Python Review

Reading Assignment

In Chapter 9, Dictionaries and Sets, from our textbook, Starting Out with Python, you should read section 9.1, Dictionaries, before next Tuesday's class.

Homework 2

I have posted homework 2 here.

It is due this coming Sunday at 11:59 PM.

Tips and Examples

Class Exercises



Two Types of Functions

Function Names

Defining a Function

Calling a Function


Local Variables

Passing Arguments to Functions

Passing Multiple Arguments

Default Values for Parameters

Global Variables

Global Constants

Functions that Return Values

Returning Multiple Values

Standard Library Functions


Accessing the Information in Files

Opening a File

Writing Data to a File

Reading Data From a File

Closing a File

Using a File More Than Once

Appending Data to an Existing File

Reading the Lines of a File

Reading Lines with a while Loop

Reading Files with a for Loop


Class Exercise 3