3.3 Math Expressions HW
Code Runner Challenge
popcorn 1
View IPYNB Source
# CODE_RUNNER: popcorn 1
value_a = 100
value_b = 10
value_c = 25
# TODO: calculate total of A, B, and C using the variables above
addition = value_a + value_b + value_c # Replace with your expression (e.g., value_a + value_b + value_c)
# TODO: calculate the difference between items A and B using the variables above
subtraction = value_a - value_b # Replace with your expression
# TODO: calculate the product of items B and C using the variables above
multiplication = value_b * value_c # Replace with your expression
# TODO: divide value A by value B and output the division using the variables above
division = value_a / value_b # Replace with your expression
print("Total:", addition)
print("Difference:", subtraction)
print("Product:", multiplication)
print("Division:", division)
Lines: 1
Characters: 0
Output
Click "Run" in code control panel to see output ...
Code Runner Challenge
popcorn 2
View IPYNB Source
# CODE_RUNNER: popcorn 2
# Grouping operations for the Poway Recovery Center booking system
total_monthly_capacity = 100
spots_requested_per_group = 4
sessions_booked = 3
# 1. Multiplication: Calculate total spots taken by the booking group
# PUT YOUR CODE HERE
taken = spots_requested_per_group * sessions_booked
# 2. Subtraction: Calculate remaining capacity for the center
# PUT YOUR CODE HERE
left = total_monthly_capacity - taken
# 3. Division: Distribute remaining spots evenly across 2 active rooms
# PUT YOUR CODE HERE
divide = taken / 2
# Print the final outputs - EDIT THE CODE BELOW
print("Total Spots Taken: ", taken)
print("Remaining Capacity ", left)
print("Users per Room: ", divide)
Lines: 1
Characters: 0
Output
Click "Run" in code control panel to see output ...
Code Runner Challenge
homeowrk
View IPYNB Source
# CODE_RUNNER: homeowrk
# Recovery Center Cost Report
cost_per_session = 35
sessions_per_week = 3
weeks_per_month = 4
enrollment_fee = 75
# 1. Calculate weekly cost
weekly = cost_per_session * sessions_per_week
# 2. Calculate monthly cost
monthly = weekly * weeks_per_month
# 3. Calculate total cost with fee
fee = monthly + enrollment_fee
# 4. Calculate average daily cost
daily = monthly / 30
# Print all results with labels
print("Weekly Cost: ", weekly)
print("Monthly Cost: ", monthly)
print("Total Cost with Fee: ", fee)
print("Average Daily Cost: ", daily)
Lines: 1
Characters: 0
Output
Click "Run" in code control panel to see output ...