Lecture 1
Welcome to MTH 3300!
This course is titled Programming and Computer Science I
In this course, we'll be using Python programming to introduce the ABCs of programming.
For the first lecture, we'll be covering the following:
Syllabus
Going over grading, homework, projects, etc.Dev environment setup
Whether its VSCode, Cursor, or Zed, we need to make sure that you have an environment ready to write Python
Hello, World! in Python
Get a little taste of writing Python
Syllabus
Pre-requisites
For this course, you should have taken at least Calculus I and passed. There are no requirements for knowing how to write code.
Contact / Office Hours
If you need to contact me, you can reach me at jaime.abbariao@baruch.cuny.edu
Office hours are by appointment. Please contact me in advance if you need support.
Recommended materials
I don't have a textbook for this course. I expect that the internet and AI tools should suffice if you need references for Python.
This class expects that you'll build some intuition for algorithmic thinking. To aid this effort, please make sure to consistently practice on LeetCode
Course Overview
This course serves as an introduction to programming with Python. We'll cover basic programming topics such as control flow, functions, classes, and even do some file I/O.
Grading
| Criteria | Percentage |
|---|---|
| Final Exam | 25% |
| Midterm 2 | 25% |
| Midterm 1 | 25% |
| Quizzes | 15% |
| Problem Sets | 5% |
| Attendance/Participation | 5% |
Exams
All exams are closed-book, paper exams.
If you perform better on the final exam than your lowest midterm grade, the lowest midterm grade gets replaced by your final exam grade.
Exam Policy
- All personal belongings should be set at the front of the class
- No bathroom breaks during the exam. If there's an emergency, you can leave the classroom, but you forfeit your exam.
Unfortunately, I've caught students cheating. If caught, you will be reported for violating academic integrity and will receive an F in the course.
Problem Sets
Because of AI, problem sets hold little weight in your final grade. You should expect 4 problem sets throughout the semester that will be structured as mini-projects.
No late problem sets will be accepted.
Quizzes
We will have quizzes after every two lectures. These will take up about the first 45 minutes of class. You can think of these as mini-exams. Each quiz will be 3 questions that mimic the format of your exams.
No quizzes will be dropped so make sure that you keep up with the course material.
Attendance
Attendance is mandatory. I'll be taking attendance before we start class and if there's a quiz that day, that will substitute as your attendance.
If you have more than 4 unexcused absences throughout the semester, you will receive a WU for the course.
Introduction to the terminal
The terminal is a text-based interface that allows us to interact with the computer's operating system.
Navigating the terminal at the end of the day is an essential skill for software engineers, which is why we'll be spending some time navigating the terminal and some basic commands.
Terminal apps
You have an array of choices when it comes to terminal emulators.
Some of the most popular options these days are the following:
Of course you're also free to just use your stock terminal which should be Terminal on macOS and Powershell in Windows.
Note that if you decide to use Powershell on Windows, you may have a different set of commands that you'll run. I'll do my best to provide the equivalent command, but you may have to use AI or Google to figure it out.
Windows Subsystem for Linux
Another option for Windows users who want an experience closer to UNIX systems is to use WSL (Windows Subsystem for Linux). This allows you to install a Linux distribution on your machine and run the commands that macOS users are using as well.
You can find more details here about this feature. Highly recommend it given how finnicky it can get to work with Windows!
Step-by-step tutorial
We'll approach learning the terminal by creating a directory called mth-3300/ at our home directory
Figuring out where you currently are in the terminal
Suppose that you've opened the terminal, most of the time you'll start at the home directory, but if you find yourself somewhere else, how do you figure out the path to your current directory?
What is in the current directory?
Now that you're in some directory, how do you know what files and directories are nested within your current directory? To get a list of files and directories you can use the following commands
We do have to note though that there are files that are typically hidden when using the above command. These hidden files typically start with a
.such as.gitignoreor.env.localIn order to force these to show up in the terminal, we have to run an alternative set of commands.
Navigating the file system with the terminal
In order to navigate to our home, we can use the following command
However, the
cdcommand is more powerful than that. We can use thecdcommand in order to jump to any directory as long as we know the path to to it.Suppose that we have the following directory structure:
Suppose that I wanted to jump to
textbooks. How would I do that?There are also relative paths we can take. Suppose now that I'm in
~/downloads/textbooksbut now I want to go up to just~/downloads/. To get up there, I would have to enter the following command into the terminalIf you wanted to go up several parent directories, then you'll have to do something like the following
Creating a directory and a file
Now that we're in a directory where we want to create out
mth-3300directory. How do we go about doing that?Now let's
cdinto that newly created directory and create atest.pyfile. To create this file, we'll need to run the following commands after wecdintomth-3300Copying files and directories
Suppose that you want to create a copy (not deleting the source) of a file or a directory. Let's say that we want to create a new file called
test2.pyfrom the content oftest.pyNow suppose that we have a directory called
project-template/and we want to create a new project calledtodo/.Moving/renaming files
Note that
cpduplicates the resource. If we want to make sure that we're moving the resource to a new location then we'll have to use themvcommandDeleting files and directories
To delete a file, we use the
rmcommand. Note that you should generally be careful what you're deleting because this could damage your operating system.For directories, you'll use the infamous
rm -rfcommand
It'll take time to become comfortable with the terminal, but it's a worthy investment!
Dev Environment Setup
Choosing your editor
You can use any text editor or IDE you're comfortable with. Here are some popular options:
- Visual Studio Code (Recommended): Free, lightweight, and works on all platforms. Install relevant Python ecosystem extensions.
There are other editors like Cursor, Zed, or even modal text editors like vim/neovim or emacs.
For any of these options, AI tools are generally enabled by default so please make sure to disable them while you're learning.
Installing Python
Head over to python.org/downloads and download the latest stable version for your OS. Run the installer and make sure to check "Add Python to PATH" on Windows.
Once installed, verify it worked by opening your terminal and running:
You should see something like Python 3.x.x. If you get a "command not found" error, restart your terminal and try again — or double-check that Python was added to your PATH.
On macOS, the system ships with a very old Python 2 under python. Always use python3 to make sure you're running the version you installed.
Virtual Environments
When you install Python packages (libraries), they get installed globally by default — meaning every project on your machine shares the same set of packages. This causes problems fast: Project A needs version 1.0 of a library, Project B needs version 2.0, and they can't coexist.
A virtual environment is an isolated Python installation scoped to a single project. Each project gets its own packages at its own versions, completely separate from everything else.
To create one, cd into your project directory and run:
This creates a .venv/ folder inside your project. Next, activate it so your terminal uses that isolated Python:
Once activated, your terminal prompt will show (.venv) at the front. Any packages you install with pip install will now go into that environment only.
To deactivate and return to your global Python:
Get into the habit of creating a virtual environment for every project. It's a small step that saves a lot of headaches down the road.
Hello, World!
Once you have your dev environment setup, then create a file called hello_world.py
Insert the following code snippet into the file:
Then the following command will run the program: