CS 115 Lab 1, Part A: Experimenting with print statements and the Online Python Tutor

Back to Lab 1


Summary

In this part of the lab, you will type print statements into an online Python tutor to see how they work.

Instructions

  1. Go to your browser tab with the Lab 1 writeup in Moodle, and answer Question 4 (and ONLY Question 4). Vocabulary is not the main point of this class, but it's important to have a common language to talk about these new concepts.
    Feel free to ask the instructor for help or search the internet -- whatever it takes to help you understand what all of these words mean.
    Click the "Check" button to check your answers until you get full credit for the question.
  2. There is an online Python 3 tutor that allows you to watch a program execute step by step. Open that website in a new tab and enter the following Python code in the box labeled "Write your Python code here:"
    print('Hello!')
    print('Hi!')
    Then click "Visualize execution."
  3. You should now see your code at the top left of the window. A red arrow points to the next instruction that will be executed. Try clicking the "Forward" button once. Verify that you can see the following:
  4. Each time you click "Forward", the next statement will be executed and the output will be updated. Try it!
  5. Click the "Edit code" link just below your program, and replace your old code with the following code:
    print('Hello!', 'Hi!')
    Visualize this program.
  6. Try to answer Question 5 in your Moodle writeup without using the visualizer. If you get stuck, you can use the visualizer to see exactly what each statement will print. Click the "Check" button to check your answers.
  7. Answer Question 6 in your writeup. Almost all of your writeups will have a question like this. There are two reasons why:
  8. Continue to Part B.