Command Palette

Search for a command to run...

Hectal
Phase 14: Interviews and Capstone
LLM Engineering · Exercise 1 of 5Next
Intermediate

Estimate monthly cost and calls in flight

Write monthly_cost(calls_per_day, tokens_in, tokens_out, price_in, price_out, days=30) that returns the cost in dollars. Prices are dollars per million tokens, and tokens_in and tokens_out are the average tokens of one call.

Write peak_in_flight(calls_per_day, peak_factor, seconds_per_call) that returns how many calls run at the same time at the peak, rounded up to a whole number. Use average rate = calls per day / 86,400 seconds, peak rate = average x peak factor, and calls in flight = peak rate x seconds per call.

What Check tests

  1. monthly_cost for the support-bot numbers is 15,750 dollars
  2. days changes the result
  3. peak_in_flight is exact when the maths is whole
  4. peak_in_flight rounds up

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

main.py
Sign in to run your code.

Output

Press Run to see what your program prints.