854 B
854 B
type, title, xp, duration, difficulty
| type | title | xp | duration | difficulty |
|---|---|---|---|---|
| challenge | The Calculator | 100 | 35 | 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:{ "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