ESC180: Introduction to Computer Programming


99 little bugs in the code

99 little bugs

1 bug fixed, run it again

100 little bugs in the code


Photo by Emile Perron on Unsplash

ESC180 is an introductory computer programming course. The course is taught with the assumption that students have no prior experience in programming. Python will be the only programming language used for this course.

You’ll start by covering fundamental programming concepts. These include functions, conditional statements, syntax, and loops. You’ll then use these basic building blocks to create simple programs. Along the way, you’ll learn about features of computers and computer programming like binary number systems, and memory storage. For assignments, you’ll be writing your own code to practice the skills and theory you’ve learned in class.

For experienced programmers, much of this course will be repetition. For less experienced or new programmers, this course will require some regular practice in order to build a new skill set.


Professor

Professor Michael Guerzhoy

Professor Michael Guerzhoy [Source]

Michael Guerzhoy (pronounced “ger-JOY”, with a hard “g”, and with the “J” pronounced like the “s” in “measure”), is teaching both ESC180 and ESC190 this year. He graduated with an Honours Bachelor of Science from the University of Toronto in Computer Science, Mathematics, and Statistics. He went on to earn a Master’s degree in both Computer Science and Statistics. Professor Guerzhoy has taught courses at the University of Toronto for quite some time, including this course in multiple years. He then moved to Princeton where he worked as a lecturer in the Center for Statistics and Machine Learning. In 2021, he returned to teach computer science in EngSci once again!


Interview


Highlights

  • Discovering Python is not a snake: it’s the coding language you’ll be using for the course.
  • That eureka moment when your program works after spending hours debugging it.
  • Generating code that solves a big, real-life problem with very basic concepts. 
  • Figuring out how recursion works!

Week in the Life of a ESC180 Student

Lectures

There are typically three hours of ESC180 lectures per week. There are no tutorials, so be sure to pay attention during lecture! The professor will explain programming concepts and go through example code.

Tutorials

There are no tutorials for this course.

Practicals

ESC180 practicals are weekly 3-hour slots held in the ECF labs. Here, you will work on your labs and show them to your TAs or get help if needed.


Recommended Exercise

There are recommended exercises for beginners, which you really should do if this is your first time coding. They will help you catch up with coding in no time. For now they are optional, but they may become mandatory.

Assignments

ESC180 has two types of assignments: labs and projects

Labs are released weekly, and you have 5-7 days to complete them. You will be challenged to program functions that complete specific tasks. The labs can be long and difficult, but they are very beneficial. Try to complete all of them: it is the best way to prepare for the midterm and final exam. They will give you an opportunity to practice coding and build on your programming skills. All labs are graded by your TA, and they are also there to help you if you get stuck: don’t be afraid to ask for help, especially if this is your first time programming.

Projects are longer than labs and are typically assigned 3-4 weeks before the due date. They are more difficult because their scope is larger. Instead of writing one standalone function, you need to write at least 4-5 functions that accomplish a broader goal. For example, you might need to track a fictional person’s physical activity and happiness levels, or build an AI that predicts its opponent’s moves in a chess game.

Exams

ESC180 usually has a midterm and a final. In these exams you will be asked both conceptual and programming questions. For questions that require you to write code, you will have to do so using pen and paper. The code you write in the exams will NOT be as difficult as the code you write in the labs; the challenge is writing it quickly and without external aids. You will find that keeping up with the labs and practicing throughout the semester will reduce your prep time. Past exams are also a good source of practice problems.


How to Succeed

Quick Tips & Equations

  • Know your if statements

  • Distinguish between “for” and “while” loops (and when to use each one).

  • Python indexing starts at 0, not 1.

  • = , != , and == are not the same.

  • Recursive functions consist of a base case and a recursive step.

More Details

Start projects early

It is totally okay to come into EngSci not knowing how to code yet! One of the blog admins learned how to code the summer before EngSci started, and they did fine in the course. You will not be alone, and there are many online resources, as well as upper years/peers who will want to help you.

Start projects early

We recommend starting ESC180 projects as soon as they are released. They require a lot of thought and iteration; they cannot be completed in one go, the night before the due date. You will need to brainstorm a solution, try it out, debug, and probably try again. Don’t be fooled by the “simplicity” of the problem statement: even if a function seems easy to write, it might take you several hours to debug.

Plan before you write

Some experienced programmers can write their code immediately after seeing a problem. However, we recommend that beginners write an outline in pseudo-code before writing any code. Pseudo-code refers to an informal version of code, written in words explaining what your program does. Plan out how your functions will interact and what they need to do in order to achieve your desired result. This way, you’ll avoid making mistakes, writing unnecessary code, and confusing yourself. Planning and sketching things out on paper is especially important when tackling projects.

Consider using helper functions

Complex programming problems are often difficult to solve using one function. However, they become significantly simpler if you break the problem into smaller sub-problems. You can solve each of these sub-problems with different functions, called “helper functions.” You can then put everything together to obtain a final solution. 

When working on ESC180 projects, helper functions can be especially useful.

Finish first, then optimize

Everyone wants to write short and efficient programs. However, focusing too hard on elegance or efficiency can stop you from making working code. Always make a program that can produce the results you need before you take it apart to make it more efficient or less ugly. Even professional software developers often show that their initial method works before making small improvements.

Don’t spend ten hours on the labs

Labs will be released a few days before the practical, so you get a chance to attempt them before asking your TA questions. Always attempt the labs! If you’re stuck on one for too long, take a break and ask your TAs and peers for help. They’re meant to be finished within a certain time frame (about three hours), but getting stuck is completely normal. Sometimes it can be a simple error or a trick you don’t know that prevents you from completing them. If you miss a deadline, don’t stress. Labs are great practice, but you have five other courses with larger assignments to manage. Use your judgment!

Remember that programming may be a whole new skill for you

Like any other skill, it will take time and practice to become comfortable at programming. You’ll make mistakes and feel frustrated when you don’t know what to do. The key is regular practice. Looking at code will not be as useful as actually writing code on your computer. Without actual practice, it’s impossible to improve.

Experiment!

This is the best way to learn coding. You’ll learn to use many useful methods and tools by playing around with code. 

Good code by xkcd


What Will You Take Out of It?

  • Programming is one of the most essential skills in science and engineering today. Many technical courses will either use programming or teach you to program, and you can always use programming to simplify calculations in assignments and labs. Many internships and jobs require programming experience, so it’s great that EngSci provides a solid introduction in first year.

  • You’ll learn how to think like a programmer. ESC180 introduces you to several programming problem-solving techniques. These include sequential, functional, iterative, and recursive programming.

    • Sequential: In basic programming, the computer follows a set of instructions one after the other. By thinking sequentially, the programmer tells the computer what information to save when moving between steps and in what order.

    • Functional: You’ll often need several small, independent functions in your program that come together to solve a problem. Thus, you need to think about the individual components of your problem and how multiple smaller functions can be combined to solve it.  

    • Iterative: By using loops in programming, you can repeat an action as many times as you need to solve a problem. You must therefore understand how to create solutions using these iterative techniques.

    • Recursive: In some cases, it is impractical to solve a problem iteratively. That’s when recursion comes in handy. You break down the problem into smaller pieces using a repeating function. You make the problem smaller and smaller until, eventually, you reach a point where the problem cannot be broken down further. You have then found a solution!

Overall, programming will give you a chance to learn and use new problem-solving strategies.


Note: The course code for Introduction to Computer Programming used to be CSC180. You may still see it referred to as such on some websites (e.g. courses.skule.ca).