Lesson 14/48 ยท ๐ Your First Python
๐ Your First PythonLesson 14/48
Phase 1 ยท Your First Python20 min
๐ Project: Tip Calculator
Use everything you've learned to build your first real program
You've learned enough to build something real.
Variables, numbers, strings, types, comments, let's combine them into a program that does something useful: splitting a restaurant bill.
This is your first project lesson. No new syntax, just applying what you know.
Variables, numbers, strings, types, comments, let's combine them into a program that does something useful: splitting a restaurant bill.
This is your first project lesson. No new syntax, just applying what you know.
The formula:
tip_amount = bill * (tip_percent / 100)total = bill + tip_amountper_person = total / num_peopleA complete tip calculatorpython
# Restaurant bill splitter
bill = 120.00 # total bill before tip
tip_percent = 18 # tip percentage
num_people = 4 # people splitting the bill
# Calculate
tip_amount = bill * (tip_percent / 100)
total = bill + tip_amount
per_person = total / num_people
# Display results
print("Bill:", bill)
print("Tip:", tip_amount)
print("Total:", total)
print("Each person pays:", per_person)Notice how each variable has a clear name, there's a comment section for each block, and the output labels tell the reader what each number means. This is professional-quality code structure.
๐ฏ
Phase Complete!
Your First Python
You can now write Python code. Describe in your own words: what is a variable, what is a string, and what is an f-string? Give one example of each.
0/500
Practice Exercises
0/3 solvedExercise 1 of 3easyGuided
โฑ 00:00Calculate the Tip
Bill is $85.00, tip is 20%.Print just the tip amount.Expected: 17.0
solution.py
1 / 3
Exercise 2 of 3easy
โฑ 00:00Split the Bill
Bill is $200.00, tip is 15%, split between 5 people.Print the amount each person pays (including tip).Expected: 46.0
solution.py
2 / 3
Exercise 3 of 3medium
โฑ 00:00Full Receipt
Bill is $150.00, tip is 18%, split between 3 people.Print a full receipt like this (exact format):Bill: 150.0Tip: 27.0Total: 177.0Each person: 59.0
solution.py
3 / 3
Solve all 3 exercises to unlock completion