0%

Values and Variables · capstone

Capstone project: Project: Plan a Group Outing

You now know how to name values, update , calculate with numbers, and place results inside messages. This project brings those skills together in one small program.

You will build a budget summary for a group outing. The starting information is already in the editor so you can focus on turning it into useful results.

Starting information

Your program begins with four variables:

activity = "museum visit"
people = 3
price_per_person = 12
snack_budget = 15

Do not change those values until after your project passes. They give you a known result to check.

Part 1: Calculate the budget

Create two new variables:

  1. ticket_total should multiply people by price_per_person.

  2. total_budget should add ticket_total and snack_budget.

Work out the expected values before you run the program:

  • Tickets cost 3 * 12, which is 36.

  • Adding the snack budget gives 36 + 15, which is 51.

Writing down an expected result is a valuable check. If Python produces something else, you know there is a difference to investigate.

Part 2: Print the summary

Use five print instructions to produce exactly:

GROUP OUTING
Activity: museum visit
People: 3
Tickets: $36
Total budget: $51

The first line can be an ordinary . Use for the other four lines so they read their values from variables.

Build it in checkpoints

You do not need to write the complete program before running it.

  1. Calculate ticket_total and print it temporarily. Check for 36.

  2. Calculate total_budget and print it temporarily. Check for 51.

  3. Remove those temporary checks.

  4. Add the five required output lines one at a time.

  5. Compare the final output carefully with the target.

Small checkpoints make it easier to locate a mistake. They are not just for beginners. Experienced programmers use them too.

Review your program

Before submitting, check that:

  • all six variable names are spelled consistently;

  • both calculated variables use , not quoted answers;

  • each f-string begins with f;

  • every opening brace has a closing brace;

  • the dollar signs are outside the braces;

  • the output has exactly five non-empty lines.

If your subscription includes Guided, a useful Monty request is:

Review my outing program against the requirements. Check the calculations first, then the output. Point out one issue at a time without rewriting the program.

The lesson instructions, Run button, and submission feedback are enough to complete the project independently too.

After it passes

Once you have a passing version, make the plan your own. Change the activity, number of people, price, or snack budget and press Run again. Watch the calculated totals and f-strings update from the new values.

To submit again, restore the four starting values listed above while keeping your calculations and print instructions. Reset restores the unfinished starter program, so use it only when you want to start the exercise again.

What you have learned

In this chapter, values stopped being isolated pieces of code. You learned to give them useful names, replace them, combine them in calculations, and present them inside clear messages.

Your outing program has a simple but important structure:

  1. Store the starting information.

  2. Calculate new information.

  3. Present the result.

That structure appears in programs of every size. In the next chapter, your programs can start receiving information from the person using them.

Task

Complete the group outing program.

  1. Calculate ticket_total as people * price_per_person.

  2. Calculate total_budget as ticket_total + snack_budget.

  3. Print exactly:

GROUP OUTING
Activity: museum visit
People: 3
Tickets: $36
Total budget: $51

Use one print instruction per line. The heading can be an ordinary ; build the other four lines with that read the corresponding .

Keep the four starting values unchanged until your submission passes.