For this assignment, you will design and implement each of the Problems listed in each file. You can find Problem 1 in main.py
and Problem 2 in variables.py
.
Download, extract, and open¶
Download the starter code for our first homework assignment. Then, extract (unzip) the contents anywhere on your computer. We highly recommend to creating a folder for this course outside of your Downloads folder, and putting the extracted folder inside of that “cse 160” folder.
Then, from VSCode, navigate to File | Open and select the homework0
folder. Be sure to open the homework0
folder, not one of the individual files.
Info
For this assignment, we are not grading on linter (flake8
) errors, but you should practice good style and address all linter errors as shown by flake8
in the Problems tab.
Problem 1¶
Manually walk through the following code and determine what the final value is for both first
and second
after the code is run. Then, in the main.py
file, replace XXX
with the final values for the variables first
and second
.
first = 8
second = 9
first = first + second
second = first - second
first = first - second
In your submission, do not copy in this code. Instead, replace XXX
in main.py
with the values for the variables first
and second
.
Problem 2¶
In the variables.py
section you’ll find the instructions below, as commented out lines. Place your answer on the line below the corresponding instruction.
- Assign the value 160 into a variable.
- Multiply the value in the variable by 2 and then store it back into the same variable.
- Print out the variable.