Here’s another snack of IPO problems.
See the original IPO Problems page for an explanation of what this is.
1. Weekly Paycheck Calculator
Write a function named weekly_pay that takes two parameters: hourly pay rate and hours worked (you choose appropriate parameter names). If hours is over 40, pay time and a half (1.5 × rate) for the overtime hours. Return the total pay.
Examples:
weekly_pay(10, 35) → 350
weekly_pay(10, 45) → 475
weekly_pay(20, 50) → 1100
2. Filter Above Threshold
Write a function named filter_above that takes a list of numbers and a threshold, and returns a new list containing only the numbers greater than the threshold.
Examples:
filter_above([2, 7, 4, 9, 12, 5], 6) → [7, 9, 12]
filter_above([10, 3, 8, 1, 15], 9) → [10, 15]
filter_above([1, 2, 3], 5) → []