Files

43 lines
854 B
Markdown

---
type: challenge
title: "The Calculator"
xp: 100
duration: 35
difficulty: 2
---
# The Calculator
> **[INCOMING — Mission Control, Earth]**
>
> Cadet, capstone. Combine everything you've learned in this module
> into one program.
>
> Implement `calculate(a, b)` that returns a dictionary with all four
> basic operations:
>
> ```python
> {
> "sum": a + b,
> "difference": a - b,
> "product": a * b,
> "quotient": a / b,
> }
> ```
>
> Convert both inputs with `float()` so results are consistent — and
> so string inputs work too.
>
> [END TRANSMISSION]
## Your Task
In `starter/starter.py`, convert both inputs to float, then return
the dictionary with the four keys above.
## Objectives
- `calculate(10, 5)` returns the four operations as a dict
- Works with int, float, and string inputs
- All values are floats