Getting Started FAQ

Programming Assignments

All programming assignments in this class require Python 3.10. There are two options for programming homeworks: you could install Python 3.10 and work on the assignments locally, or you could work on the Andrew machines.

Installing Python 3.10 locally on your own computer

If you decide to install Python 3.10 locally, it is recommended that you create a virtual environment using Anaconda and use Python 3.10 there.

  1. Follow the steps in this link to download Anaconda and create a virtual environment: (Instructions here). Note: the tutorial says to download the Python 3.7 version of Anaconda, but for the purposes of this class you will want the Python 3.10 version. An alternative to using Anaconda is Miniforge , which is essentially a more minimal version of Anaconda.
  2. If you already have Anaconda with a different Python version, you can use this tutorial to change your Python version in Anaconda.

The programming assignments for this course assume you use Python 3.10. You may need to call python311 or python3.10 or python3 if python --version shows Python version different than 3.10.x. Python 3.10 is already installed on the Andrew Linux machines, and you should be able to call it with python3.10. You are also free to use your own machine; we'll try to help you we can, but we cannot officially support all personal environments. Whether you work on an instructional machine or your own, the project submission for grading will always be through Gradescope.

Installing Python 3.10 on Andrew Machines

If you would like to use the Andrew machines for the programming assignments, you're in luck! It is already installed. You can run python3 for a 3.10 environment.

  • In order to run the programming assignments with graphics, please do the following:
    • Install XQuartz on MacOS / MobaXterm on Windows.
    • ssh with -X, or
    • ssh with -Y
    Not doing these before running Pacman with graphics could be the cause of the error _tkinter.TclError: no display name and no $DISPLAY environment variable.

    Windows users will need to connect to Andrew using MobaXterm as graphics will not work while using VSCode.

  • One option to modify files and work on programming assignment is to use Vim. A quick note about Vim is that it uses less AFS storage than VSCode, which might make it more preferable depending on how much AFS space you have. Here is a tutorial on how to use Vim and some basic commands: tutorial

    Python Editors

    Here are a few IDE's we recommend using with Python in this class, along with links to installation instructions:

    Vim is also a popular option to edit code and work on programming assignments in this class (see previous section).

    Debugging Tips

    There are many different ways to test and debug your programming homeworks locally. Here are a few recommended options:

    1. Use print statements. Using print statements in Python is extremely straightforward and allows you to check if you are handling certain cases correctly or if your values are what they should be.
    2. Use pdb. The Python tutorial P0 gives instructions on how to use pdb to set up breakpoints that can be useful when debugging your code.
    3. Check the test cases. When you run the autograder, the output will contain which test cases your code is failing on. If it is failing on a small test case, it should be easy to work out by hand and make sure that the answer is what you expect (if not, there may be some conceptual misunderstanding that affected your implementation of the problem), and run through your code to see why it is failing. You can also check the test cases in the test_cases directory in the handout, which will contain each test case and the intended solution.

  • Written Homework

    All written homeworks have the option of either using Latex to compile and complete homeworks, or using an iPad to fill in a blank PDF of the homework. One popular software for students to use Latex is Overleaf.

    Getting Started with Overleaf

    1. If you choose to use Overleaf to complete written homeworks, you can download the given zip file on the homework Diderot page and directly upload that to Overleaf. The only file you will have to modify is the yoursolution.tex file. Do not modify any other files in the handout.
    2. Some questions may ask you to draw a picture for examples, etc. Some straightforward and useful tools for creating images for your homeworks are:
      • Powerpoint/Google Slides
      • Google Drawings
      • Tikz in Latex
      • Microsoft Paint (less preferred)
      You can then export the image and upload it to your Overleaf or PDF.
    3. In order to insert images into an answer box, you can use the \includegraphics command, which will also allow you to adjust the scaling of the image. This page contains more specific information on inserting images into Overleaf: here
    4. When you have filled in the yoursolution.tex file, you can download the PDF from Overleaf and submit that PDF to Gradescope. As long as you have not modified any other files, the pages on your PDF should match the Gradescope alignment, but please double check that your pages align with the Gradescope outline, as we will not grade questions that are misaligned. To check if your pages are aligned, you can look at the outline for the assignment on Gradescope or check that each question actually matches up with the correct box in your submission.