Python (CSCI 1301, CSCI 1302, ITEC 2260, and ITEC 2270)
The following are code examples that I built for use in tutoring Introduction to Computer Programming and Application Development students. Each code example covers one or more specific topics.
Classes and Objects
Exception Handling
- Exception Handling (a simple exception handling example)
- Average Test Score (another exception handling example)
File Handling
- File Handling (a simple file handling example)
- File Handling Parsing (another file handling example)
For Loops
- For Loop with Input (a simple for loop example)
- For Loop with Asterisks (another for loop example)
- For Loop Population Growth Simulator (let's put for loops to use!)
Functions
- Call a Function (a simple functions example)
- Letter Grades (let's put functions to use! includes some if logic)
- Pass Lists to a Function (another functions example)
Dictionaries
- Simple dictionary
- Iterate through a dictionary
- Course Info (let's put dictionaries to use!)
If Else Logic
- If Else Logic Package Weight (a simple if else logic example)
Lists and Arrays
Note that Python doesn't technically have built-in support for arrays. Instead of arrays, Python uses Lists.
- Calculate the Average of Items in a List (a simple list example)
- Build a List with a Loop (another list example)
- Seating Chart (use a list like an array)
Match Case
- Match Case (a simple match case example)
While Loops
- Sentinel Loop (using a while loop as a sentinel loop)