- Due: Tuesday, May 21st no later than 5pm.
- Submission instructions: complete the assigned number of activities in each of the assigned subsections of Chapter 7. You do not need to submit anything to Brightspace.
- Deadline reminder: once this deadline passes, Runestone Interactive will no longer allow you to collect points for completing the activities.
From chapter 7:
booltype has values
- Boolean operators:
- Logical operators:
- Conditional statements:
- Conditional statements can be nested
- Writing and calling Boolean functions
- Complete the required number of activities for each subsection in Selection.
Grading - 10 points
- 10 points - the required number of activities were completed for each subsection before the deadline.
This reading assignment will be graded with scores in Brightspace by office hours the following class day.
Consider a simplified game of UNO that has forty different cards. Each card has a color (“red”, “yellow”, “green” or “blue”) and a value (0, 1, 2, 3, 4, 5, 6, 7, 8 or 9). One card can be played on top of the the other as long as either the numbers match, the colors match, or both. Complete the boolean function below so that it returns
True if the second card can be played on the first card and
def legal_play(first_value, first_color, second_value, second_color): # your commands here
legal_play(3, "blue", 3, "green")
legal_play(5, "yellow", 7, "yellow")
should both return True, but
legal_play(9, "red", 6, "green")
should return False.
Take key-events.py and modify it so that the turtle only moves if it will still be visible. Use one boolean function in your solution.