Build a Café Change Calculator in Python (Beginner Project)
Description: A slice of cake costs £1.37 and you pay with £2. Which coins should the cashier hand back? In this beginner Python tutorial, you’ll build a café till that counts out your 63p change using the fewest UK coins.
Code along with a for loop and divmod() to work out how many coins to take and how much change is left. You’ll handle exact payments, catch a customer who’s a penny short, and track down a one-line bug that turns four coins into 63 pennies.
Chapters
00:00 The 63p change puzzle
02:04 Build the café till in Python
03:45 How divmod() works
06:13 Why the till checks the largest coin first
09:00 Exact payments and underpayments
12:18 Find the bug that pays out in pennies
18:21 Predict the change from £5
19:27 What changes when the price goes up by 1p?
23:27 Check the receipt and count the coins Close description
Code along with a for loop and divmod() to work out how many coins to take and how much change is left. You’ll handle exact payments, catch a customer who’s a penny short, and track down a one-line bug that turns four coins into 63 pennies.
Chapters
00:00 The 63p change puzzle
02:04 Build the café till in Python
03:45 How divmod() works
06:13 Why the till checks the largest coin first
09:00 Exact payments and underpayments
12:18 Find the bug that pays out in pennies
18:21 Predict the change from £5
19:27 What changes when the price goes up by 1p?
23:27 Check the receipt and count the coins Close description
