Follow this setup document.
Don't be scared, we know it's long! After completing all the steps in the setup document correctly , your machine should be all set up for the rest of the quarter!
Download THIS main.py to whichever directory you plan to use to store homework assignments. (DO not use the same file from the installation process.) Open it in VSCode.
Step through the following code to determine what the final value stored in the variables first and second would be:
Note: If you can, you should try stepping through this code manually first so that you can practice how you reason through code.
first = 8
second = 9
first = first + second
second = first - second
first = first - second
Now replace the XXX's with your answer in main.py.
For example, if the variable first
and the variable second
were to have final values 160
and 163
, then your program should have output that looks like the following:
first is 160
second is 163
Download THIS variables.py to whichever directory you plan to use to store homework assignments. (DO not use the same file from the installation process or part 2a) Open it in VSCode.
In this program, we have provided some comments for what we want you to do in this file. Follow the comments to create a variables, maniupalte the value, and then print that value. Your resulting program will likely have three lines of code (three lines that are not just blank or have comments).
Once you have finished, you should run your program and have some output that looks like this:
320
Note: you should not just put a print(320)
statement in your code. Be sure that you actually make use of the variable you declared and used in the other lines of your program.
Once you finish Part 2, submit your modified main.py
and variables.py
to Gradescope. Your files must be named main.py
and variables.py
. You should get a confirmation email once you have submitted it. You should also be able to see some output from some tests we have included in gradescope, though you may have to wait a little bit for the tests to finish running. A completely correct submission should not have anything red in the output on Gradescope. We are not grading you on your linter errors for hw0, but you should still try to fix them! You can resubmit to Gradescope as many times as you want before the deadline.
Below, we have provided what you should see after a CORRECT submission. Note that you may have different output under "autograder output". This is just an example to show what it is like when you submit the correct files.
Below, we have provided what you should see after a WRONG submission. This specific error comes from not submitting the correct files to gradescope.