You may exit out of this review and return later without penalty.
Close
Sharing assignments in OpenClass
OpenClass is on a mission to improve & democratize education. Through our platform, educators can share assignments privately or with our entire community to improve accessibility of the best learning resources around the world.
Our assignments guide students through research-backed study sessions to reinforce learning. If this review is relevant to your teachings, feel free to add it to one of your classes!
Our format is simple and engaging: students are asked a retrieval question, then shown corrective feedback and a multiple-choice mastery question to assess their understanding of the material. Assignments adapt to unique student needs and continue to draw questions until a student has demonstrated mastery.
Evaluate the boolean expressions shown in Figure A.
Provide values for `a`, `b`, and `c` that make the following statement evaluate as `True`:
`a + b == c and (c is a or c is b) and a != b`
What is wrong with the code in Figure A?
What's the output of the code in Figure A?
Write a function that returns `"a is greater than b"`, `"a is less than b"`, or `"a is equal to b"` depending on the values of two int input params `a` and `b`.
Write a function that converts an int `num` between 0-9 (inclusive) to its string equivalent (i.e., 1 -> "one").
Write an if statement that prints `a and b are equal` if two variables `a` and `b` have equal values, or `a and b are not equal` otherwise.
What do the boolean operators `and`, `or`, and `not` do in Python?
What is an if statement?
In Python, if/else statements are used to control the flow between two different options. How can we control the flow between more than two different options?
Fix the syntax error in the starting code.
Adjust the value of the variable `a` in the following code so that `a is below zero!` is printed.
What's the output of the code in Figure A?
(Student response here)
False
--
The `is` operator compares instances in memory. Even though the values of `a` and `b` are the same, since lists are mutable (meaning, they can be modified without being entirely recreated), `a` and `b` point to different places in memory.
What is the output of the code in the updated figure, Figure B?