▶ Sign up free for the video, slides & prompts
The lesson below is open to all. Enter your email once to unlock every video, slide deck, prompt and code example on this device.
Checking…
Mini project: tip and bill calculator
Put it all together in a small program you can show off.
🎬 Video version coming soon — read it now
Time to put everything together: print, variables, maths, strings, f-strings and input. You'll build a small restaurant bill calculator that you could actually use.
What it does
- Asks for the bill amount, the tip percentage and the number of people
- Adds 5% GST and the tip
- Prints a neat receipt with each person's share
The code
:>9.2f means "two decimal places, right-aligned in 9 characters", so the rupee amounts line up like a real receipt.
Try it
Run it with a bill of 2400, a 10% tip and 3 people. You should see a total of ₹2,760.00 and a share of ₹920.00.
Make it yours: challenges
- Round each share up to the nearest rupee. Hint:
import mathandmath.ceil(). - Ask for the restaurant name and print it at the top of the receipt.
- Show how much the tip adds per person.
- Ask an AI tutor to review your finished code, and decide for yourself which suggestions to keep.
What you learned in this course
- What programming is, and how to run Python in Colab
- print, comments, variables, ints, floats and strings
- f-strings, input() and converting types
- Reading errors calmly, and using AI as a tutor rather than a crutch
Next course: Decisions & Loops. You'll teach your programs to make choices and repeat work, and build a number-guessing game.
In one line
You can now write a useful interactive program; next, you'll make it choose and repeat.
Share with a friend