Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Welcome to the Roastery Batch Planner

This course is about JavaScript’s numbers next to Python’s: dividing, rounding, reading them from text, and formatting them. JavaScript arithmetic rarely stops with an error, so a port that looks right can print the wrong number. Along the way, you’ll port a coffee roastery’s Python batch planner.

Here’s a first taste. The planner counts the full 12 kg batches the drum takes. These are its batch lines in Python:

Language: Python
WEIGHT_LOSS = 0.15
DRUM_KG = 12

order_kg = 37.5
green_kg = order_kg / (1 - WEIGHT_LOSS)
full_batches = int(green_kg // DRUM_KG)
print(f"Batches: {full_batches} full")

Python prints three full batches:

Language: Program Output
Batches: 3 full

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.