Question: Part B (5 points) - assignments with compound expressions Remember to continue using the repl which contains your code from part A B1 . Write
Part B (5 points) - assignments with compound expressions
Remember to continue using the repl which contains your code from part A
B1.
Write an assignment statement that sets the variable assigns a variable named blue_level to the remainder when color is divided by green_offset (normally this as: "color modulus green_offset").
B2.
Write an assignment that assigns a variable named red_level the result of dividing color by red_offset using whole-number division (e.g., the division that only returns the whole number amount).
STUDENTS SHOULD DOWNLOAD THEIR REPL AS A ZIP FILE AND SUBMIT TO AUTOLAB Lab 1 AFTER COMPLETING THIS CODE
Part C (5 points) - assignments with more involved compound expressions
Remember to continue using the repl containing your code from part A & part B
You will be writing code which performs calculations using the numbers used by computers to represent different colors. To do this, you will need to use blue_level and red_level from part B and the following rule:
- percentage change is usually expressed as a decimal between -1.0 and 1.0. It is calculated by taking the updated value minus the initial value and then dividing that result by the initial value
C1.
Write an assignment that assigns a variable named decimal_change to the percentage change in the red level if red_level were updated to be 200. (Hint: using floating point division is helpful)
C2.
Write an assignment that assigns a variable named orig_blue so that it contains the initial blue value (as a float). You should assume the updated blue value equivalent to blue_level and that the percentage change was 0.33
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
