CS 115 Pre-Lab 1

Lab 1 Deadlines

[Back to Lab 1 instructions]


Vocabulary

Vocabulary is not the main point of this class, but it's important to have a common language to talk about these new concepts.

Go to Moodle and open the Pre-Lab 1 assignment. Answer Question 1 only.

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.

When you're done, click the "Check" button to check your answers. Keep trying until you get full credit for the question.

Exploring output statements with the Online Python Tutor

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."

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:

Each time you click "Forward", the next statement will be executed and the output will be updated. Try it!

Click the "Edit code" link just below your original program, and replace your old code with the following code:

print('Hello!', 'Hi!')

Visualize this program.

Try to answer Question 2 in the Moodle pre-lab without using the tutor. If you get stuck, you can use the tutor to see exactly what each statement will print. Click the "Check" button in Moodle to check your answers.

Answer Question 3 in the Moodle pre-lab.

Preview of Lab 1

This week, you will be given a program that asks for a person's name and greets that person by name. Here is an example of what that program might do. In this example, the text that is italicized and underlined is typed by the user. The rest of the text comes from the program.

What is your name?
Katniss
Hi there, Katniss

Here is another sample output from the same program. This time, the user has typed a different name, which makes the output different too:

What is your name?
Peeta
Hi there, Peeta

Answer Question 4 in the Moodle pre-lab.

From there, you will modify the program to ask a different question and supply a different response to the user's input.

Finally, you will be given a program that pops up a graphics window and asks the user for their name graphically:

Screenshot of basic program

You will modify the question and output of this program in the same manner.

Submit your pre-lab

Review your answers, and then click the Next button at the bottom of the quiz. Once you do that, you should see something similar to this:
Quiz attempt summary

Click the Submit all and finish button. You MUST do this so that your writeup can be graded! Once you have submitted your quiz, you should see something similar to this at the top of your Moodle window. The important part is that the State shows up as Finished.
Quiz confirmation

Please leave this tab open in your browser, and flag down a member of the course staff to be sure you've submitted it correctly.

Go back to the Lab 1 instructions to start the main part of Lab 1.