Build the Booking System
The main build lesson for turning the Pet Services plan into a working Python booking system.
This page turns the project plan into code. It moves from structured input and decisions toward a usable booking summary.
Project Navigation
- Back to Pet Services Project Hub
- Previous: Planning and Decision Tree
- Next: Worked Solution: Booking System
Build Sequence
- collect all required input values
- validate service type and key fields
- calculate total cost with conditional logic
- print a clean booking summary
Minimal Working Pattern
pet_name = input("Pet name: ")
pet_size = input("Size (small/medium/large): ").lower()
service_type = input("Service (bath/haircut/full): ").lower()
if service_type == "bath":
base_cost = 25
elif service_type == "haircut":
base_cost = 35
elif service_type == "full":
base_cost = 50
else:
base_cost = None
if base_cost is None:
print("Invalid service type. Please run again.")
else:
print("=== Booking Summary ===")
print("Pet:", pet_name)
print("Size:", pet_size)
print("Service:", service_type)
print("Total cost: $", base_cost)
Quality Checks
- invalid service types are handled safely
- all required details appear in output
- cost logic is easy to trace back to your planning map
Lesson 2: Generating the Pet Service
Project Overview
We will create a Python program that simulates some type of pet grooming service. The program will collect and interpret information from the user to create a booking summary and calculate a cost.
Project Requirements
- Pet name
- Pet breed
- Pet’s age (in human years)
- Another characteristic of pet (example: size)
- Type of service requested (bath, haircut, full grooming)
- Calculate the total cost of the service based on certain characteristics of the pet
- Display a summary of the booking including all the information about the pet that the user input at the start of the program
Lesson 2: Learning Intention
- I can convert my decision tree into a functioning Python program.
- I understand how to store variables and use conditional statements to create a program where user input impacts outcomes.
How we will build the program (3 phases)
- Collecting and storing the user inputs
- Validating and manipulating the data
- Generating the final booking confirmation
Phase 1
In the code below you can see that the program asks for user input and stores that information in a variable with an appropriate name. You will need to replicate a similar idea for your pet services program.
Remember input() always gives you text (a string), so for ages and prices you will often need: int(input("..."))
Phase 2
In my program I decided to convert the dog’s human age to dog years. This requires the dog’s age in human years to be stored as an integer. The code below multiplies this value by 7 before displaying the age in dog years on the final booking confirmation.
The code also checks what size the dog is and changes the price accordingly. You will need to work out what features of your program require you to check or manipulate the data.
Hints for your pet service version
- Think about which inputs affect cost (service type, size, age, breed).
- Use .lower() to make comparing inputs easier (example: "Small" and "small" become the same).
- If you want to check if an answer is valid, you can compare it to a list of allowed options.
Phase 3
When we display the final booking confirmation for the user, there are some clever ways we can use formatting to display text that includes information from our stored variables.
- \n prints the string on a new line
- f in f"..." means a formatted string (f-string). It lets you insert variables using { }.
- .capitalize() makes the first letter uppercase (useful for names)
✅ Lesson 2 Student Checklist
☐ I have created variables for each user input (pet name, breed, age, size, service).
☐ I used int(input("...")) for any value I want to do maths with (like age).
☐ I used if / elif / else to set a price based on pet characteristics and the selected service.
☐ My program prints a clear booking summary that includes every key piece of input data.
☐ My program prints the final total cost.
☐ My output is readable (new lines, headings, tidy formatting).
Common mistakes and quick fixes
- ValueError when using int(): you typed letters instead of a number. Re-enter the age using digits only.
- My if statement never runs: your input might be "Small" but you checked "small". Fix by using .lower() on the input.
- My output looks messy: add a heading and use \n to space lines out.
📤 Submit (Discussion Reply)
Instead of posting screenshots, you will upload your .py file as your submission.
PetService_FirstnameLastname.py
Example: PetService_AlexNguyen.py
How to upload your .py file in your reply
- In Thonny: File → Save as and save your program.
- Go back to this discussion and click Reply.
- Look for the Attach button (paperclip icon) in the reply box.
- Select your .py file and upload it.
- In your reply text, write 1 to 2 sentences explaining what your pricing rules were (example: size changes price, service changes price).