seed: curriculum content
This commit is contained in:
42
1.solar-system/2.first-light/10.the-calculator/index.md
Normal file
42
1.solar-system/2.first-light/10.the-calculator/index.md
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
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
|
||||
Reference in New Issue
Block a user