+1 (208) 254-6996 essayswallet@gmail.com
Select Page

Work through the Module 8: Lab Activity (located in this module) and submit the deliverables listed in the document

Module 8: Lab Activity – Booleans

Deliverables:

· Python program solutions to the following 7 problems

Make Sure You:

# The date

`# What the program does`

· Fix any bugs (try out the debugging techniques you read about)

Game Example from How to Think Like a Computer Scientist:

For example, suppose we can slay the dragon only if our magic lightsabre sword is charged to 90% or higher, and we have 100 or more energy units in our protective shield. We find this fragment of Python code in the game:

de Morgan’s laws together with the logical opposites would let us rework the condition in a (perhaps) easier to understand way like this:

We could also get rid of the not by swapping around the then and else parts of the conditional. So here is a third version, also equivalent:

Problem 1 – Write a function that takes two inputs from a user and prints whether they are equal or not.

Problem 2 – Write a function that takes two inputs from a user and prints whether the sum is greater than 10, less than 10, or equal to 10.

Problem 3 – Write a function that takes a list and prints if the value 5 is in that list.

Problem 4 – Write a function that takes a year as a parameter and returns True if the year is a leap year, False if it is otherwise.

Consider the requirements of a leap year:

· The year is evenly divisible by 4

· If the year can be evenly divided by 100 it is NOT a leap year, unless:

· If the year is also evenly divisible by 400, then it is a leap year.

Problem 5 – Write a function that checks whether your game character has picked up all the items needed to perform certain tasks and checks against any status debuffs. Confirm checks with print statements.

Game Character has the following item list: [pan, paper, idea, rope, groceries]

Game Character has the following status debuffs: [slow]

Task 1: Climb a mountain – needs rope, coat, and first aid kit, cannot have slow

Task 2: Cook a meal – needs pan, groceries, cannot have small

Task 3: Write a book – needs pen, paper, idea, cannot have confusion