IT 117: Intermediate Scripting
Class 14

Today's Topics


Homework 7

I have posted homework 7 here.

It is due Sunday, March 25th, at 11:59 PM.

It is not due this coming Sunday to allow you to study for the Mid-term Exam.


There will be no graded quiz the week after the Spring break.

There is no Class Exercise for today's class.


The mid-term exam will be given on Tuesday, March 20th.

This is the first Tuesday after the Spring break.

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.

You will only be responsible for the material in the Class Notes for that class on the exam.

The Mid-term is a closed book exam.



Dictionary Literals

Getting Values from a Dictionary

Changing a Dictionary Value

Dictionaries Are Not Sequences

Looping Through a Dictionary

Tuples As Dictionary Values

When To Use a Dictionary

Adding Elements to a Dictionary

Lists versus Dictionaries

The in And not in Operators

Deleting Elements from A Dictionary

Getting the Number of Elements in a Dictionary

Sorting Dictionary Keys

Extracting Values from a CSV File

Keys Are Immutable

Values in a Dictionary

Dictionary Methods

The clear Method

The get Method

The pop Method

Sets in Mathematics

Set Membership

Subsets and Supersets

Union of Sets

Intersection of Sets

Difference between Sets

Sets in Python

Creating a Set in Python

Running set with an Argument

Set Literals

Adding Elements to a Set

Removing Elements from a Set

The Size of a Set

When Are Sets Equal?

Elements in A Python Set

for Loops with Sets

Testing for Set Membership

Union of Sets in Python

Intersection of Sets in Python

Difference between Sets in Python

Subsets and Supersets in Python

The clear Method

min And max with Sets

Working with the Operating System

The os Module




os.rename(old_name, new_name)


os.rmdir(path )

os.mkdir(path )

Running Unix Commands within Python


The os.path Module

os.path.isfile(path) and os.path.isdir(path)


The sys Module

Getting Values from the Command Line

Leaving a Running Script

Usage Messages

The Characters in Regular Expressions

Ordinary Characters in Regular Expressions

Meta-characters in Regular Expressions

The . Meta-character

The * Meta-character

The + Meta-character

The ? Meta-character

The \ Meta-character

Character Classes

\d and \D Character Classes

The \w and \W Character Classes

The \s and \S Character Classes

Using Regular Expressions to Find a Match

Raw Strings

Match Starts from Beginning of String

Getting Strings from a Match

The ( )Meta-characters

Repetition in Regular Expressions

Specifying a Range of Repeating Characters

Creating Custom Character Classes

Ranges of Characters in a Character Class