CS 115 Lab 2, Part A: Setup and Practice

[Back to Lab 2] [Back to CS 115 schedule]


Setup

  1. Before you start writing code, you will set up a directory for this assignment on the blue server. Follow these procedures to mount your blue home-directory on the local machine.
  2. Once you have mounted your blue account on the local machine, create a folder called, cs115
  3. Create a folder in cs115 folder called, lab02
  4. Now, launch PyCharm and create a project in your blue account by choosing cs115 first and then lab02.

Practice

  1. Answer Questions 1-5 in your writeup (on Moodle). Click "Check" after you answer each question to check and save your work.
  2. In a new browser tab, visit the online Python 3 tutor and enter the following Python code:
    x = "I"
    y = 'see'
    x = "what"
    x = 'you'
    y = "did there!"
    Then click "Visualize execution."
  3. You should now see your code at the top left of the window. The next instruction to be executed is highlighted. Try clicking the "Forward" button once. Your program's output will be displayed in the window just below your program, and the current values of your variables will be displayed on the right.
  4. Slowly click "Forward", and watch as each statement is executed in order. Pay attention to the values of your variables and how they change.
  5. Try to answer Question 6 in your Moodle writeup based on what you observed. If you get stuck, you can click the "First" button in the Online Python Tutor to restart the visualization.
  6. Continue to Part B.