In the summer of 2022, I taught an introductory programming course for eight incredible students on a program from the Saudi Basic Industries Corporation. This course closely mirrored the contents of the department’s introductory programming elements course, CS 303E, although it is not an official version focourse.
The course was primarily managed and run through Canvas. However, since I believe in making course materials available, I’ve posted the lectures and assignments here. Because these are recovered from Canvas/Slides, the formatting may be slightly off.
I would like to thank Mike Scott for letting me use his slides + template materials, and Bill Young for providing inspiration for several of the assignments.
Lecture Slides #
- Lecture 1: Introduction
- Lecture 2: Simple Python
- Lecture 3: Conditions and Boolean Logic
- Lecture 4: Loops and Iteration
- Lecture 5: Functions
- Lecture 6: Files
- Lecture 7: Lists
- Lecture 8: 2D Lists
- Lecture 9: Tuples and Strings
- Lecture 10: Dictionaries
- Lecture 11: Classes and OOP
- Bonus Lecture: Machine Learning
- Bonus Lecture: Cybersecurity
Assignments #
- Assignment 0: Getting Started
- Assignment 1: Tower
- Assignment 2: Bridges
- Assignment 3: Minimax
- Assignment 4: Newton
- Assignment 5: 1D Diffusion
- Assignment 6: 1D Diffusion, Again
- Assignment 7: Credit Cards
- Assignment 8: Ciphers
- Assignment 9: Minesweeper
- Assignment 10: Heat
- Assignment 11: DNA
- Assignment 12: DNA with Class
- Final Project
0001
Introduction
Welcome to Intro to Programming! This will be a short, fast-paced introduction to programming in Python with a slight focus on numerical applications. The topics covered will be similar to that of a standard introductory course: conditionals, loops, lists, object-oriented programming, recursion, and overviews of Python's other library types.
You will prepare a short final project for this class. This is a chance for you to practice applying your Python programming skills to a real world application, and to learn a little more about programming in a specific field.
Minesweeper Counter
Minesweeper is a popular single-player puzzle game. It is played on a 2D grid. When the player clicks on a square, it is revealed, and one of three possible outcomes occurs:
Ciphers
For almost as long as humans have had writing, we have had ways of trying to conceal what we write. The oldest known cryptographic systems are from 1900 BCE, almost 4000 years ago.
Credit Card Validation
When you enter a credit card number on most online websites, they can instantly tell whether the number is valid or not. How do they do this?
Storing and Reading Data
In the last assignment, you created a simple 1D trajectory of a particle undergoing 1D diffusion. Sometimes, we may want to store the results for later analysis--for example, maybe we want to calculate lots of different statistics (mean distance from zero, mean squared distance from zero, how far it travels in a certain period, etc.), but we don't know which yet.
1D Diffusion Simulator
Diffusion is one of the fundamental chemical processes which cause molecules to move. It is crucial to many (if not all) biological and chemical processes.
How fast a molecule travels depends on two things: how fast the molecule diffuses, and any biasing force that might be applied to it. If we think about this in terms of real gases, the diffusion speed is dependent on how heavy the molecules are (e.g. helium diffuses faster than sulfur hexafluoride), and the biasing force corresponds to things like wind or air movement that might carry the molecules along with them.
Newton's Method for Square Root
How do you find the square root of a number? This question has many important applications in science, graphics, and physical simulation. While there are many speedy, innovative (and sometimes mind-blowing) ways to do this, this assignment will have you implement one of the classic methods to solve this problem: Newton's Method.
Minimax
Write a program which accepts an arbitrary number of integers as input from the user and prints the minimum and
maximum of numbers entered. The user will stop the input loop by typing in the string "stop"
. Once the
user enters "stop", you'll print the minimum and maximum of the numbers entered. See the examples below for an
example of how the program should work.
Calculating Bridge Condition Scores
Background
Several months ago, the Texas Department of Transportation (TxDOT) released a report on the condition of every bridge in Texas. Some UT community memberswere concerned because a bridge on campus, the Moody pedestrian walkway, got a bridge rating score of 47.4 out of 100.
DNA Library Part 2
The DNA library we made last time had a few disadvantages. In this assignment, we will hopefully fix some of them, as well as add some additional features.
DNA Library
DNA is the chemical which encodes genetic information for all life on Earth. It consists of four bases: Adenine, Cytosine, Guanine, and Thymine, in a linear structure.
Interestingly, when doing computations, we often prefer to treat DNA as strings, because of its structural similarity
to strings in computer science. We treat each base as a letter (A
, C
, G
,
T
), which allows us to use functions meant for strings to manipulate DNA sequences.
Solving the Heat Equation
Take a metal bar which is hot at one end (suppose it was dipped in boiling water for a few seconds). What happens to it next? The heat moves down the bar--the hot end gets cooler and the cold end gets warmer--until the entire bar is a uniform temperature. Finally, after a long time, the entire bar will cool down to the same temperature as its surroundings.
Tower Drawing
Your task for this assignment is to write a program that prints a tower. For example, here is what an output of the UT Tower might look like (note that this output does not follow the rules, so you cannot use it for your assignment!):
Assignment 0
Getting Set Up With Tooling
In principle, you could write code with nothing but a pencil and paper. In practice, having good software tools is a huge help. Good tools can make it much more pleasant to write code, help catch mistakes early, and, in very limited cases, even write code for you.