IT 116: Introduction to Scripting
Class 28

Today's Topics


Final Exam

The final exam will be given on Thursday, May 17th from 11:30 - 2:30.

The exam will be given in the same room we use for this class.

It will consist of questions like those on the quizzes along with questions asking you to write short segments of Python code.

60% of the points on this exam will consist of questions from the Ungraded Class Quizzes.

Today's class will be a review session.

Even though classes do not end until the following week, today's class will be the last class.

Instead of having a Class 29, I will have Office Hours all day, from 11 AM to 6 PM.

You will only be responsible for the material in today's Class Notes and the review for the Mid-term, which you will find here.

Although the time alloted for the exam is 3 hours, I would expect that most of you would not need that much time.

You will not be able to leave the room until you turn in your exam paper so you should visit the restroom before you take the test.

The final is a closed book exam.

Standard Library Functions

Creating Random Numbers

The random Module

Random Number Seeds

Functions that Return Values

Returning Multiple Values

Storing Functions in Modules


Accessing the Information in Files

Opening a File

Reading Data From a File

Writing Data to a File

Closing a File

Appending Data to an Existing File

Using the readline Method

Reading Files with a for Loop

Running a Script Without python3


Runtime Errors


Dealing with Runtime Errors

Different Exception Types

The else Clause



The list Function

The Repetition Operator

Concatenating Lists

Empty Lists

Using a for Loop with Lists


The len Function

Changing Elements Using Indexes


Leaving Out Indexes in a Slice

The in Operator

List Methods

The append Method

The sort Method

The reverse Method

The del Statement

The min and max Functions

Problems with Copying Objects

Copying Lists

Functions That Change Lists

List Elements

Two-Dimensional Lists


Why Use Tuples?

Strings Are Sequences

Accessing Characters With Indexing

Negative Numbers as Indexes

Using a for Loop with Strings

Strings Are Immutable

String Slicing

Testing Strings with in and not in

String Methods

String Testing Methods




String Methods That Produce New Strings




Splitting a String