Overview
This prompt aims to guide programmers in creating conditional statements for determining movie ticket prices based on age. Beginners and educators in programming will benefit from this structured exercise.
Prompt Overview
Purpose: This code determines movie ticket prices based on age categories.
Audience: It is intended for programmers learning conditional statements in coding.
Distinctive Feature: The program uses clear conditional logic to handle multiple age ranges efficiently.
Outcome: Users receive accurate ticket pricing information based on their age input.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Film & Television Production, General Business Operations, Productivity & Workflow
- Techniques: Decomposition
- Models: Claude 3.5 Sonnet, Gemini 2.0 Flash, GPT-4o, Llama 3.1 70B
- Estimated time: 5-10 minutes
- Skill level: Intermediate
Variables to Fill
- [age_value] – Age Value
- [cost] – Cost
Example Variables Block
- [age_value]: Example Age Value
- [cost]: Example Cost
The Prompt
Create a series of conditional statements to determine and print the cost of a movie theater ticket based on an age variable. The conditions are:
– Children under 4 years old: “Free”
– Children between 4 and 12 years old (inclusive): “$5”
– Teenagers between 13 and 19 years old (inclusive), and senior citizens aged 65 and above: “$10”
– Adults between 20 and 64 years old (inclusive): “$15”
For each specified age, the output format should include the age followed by the corresponding ticket cost. Maintain correct capitalization, as different cases will be interpreted differently by the computer.
# Steps
1. Define a variable `age` for each test case.
2. Use conditional statements (if-else) to check the age against specified conditions.
3. Print the age followed by the corresponding cost based on age.
4. Repeat for all test cases.
# Output Format
The output should be in the following format:
“`
Age: [age_value]
[cost]
“`
Where:
– `[age_value]` is the age being tested
– `[cost]` is the corresponding ticket price as specified in the conditions.
# Examples
5. Input: `age = 1`
Output:
“`
Age: 1
Free
“`
6. Input: `age = 12`
Output:
“`
Age: 12
$5
“`
7. Input: `age = 15`
Output:
“`
Age: 15
$10
“`
Repeat this pattern for each age indicated:
– 1, 3, 4, 12, 13, 19, 20, 50, 65, and 80.
# Notes
– Ensure that each condition properly uses logical operators to capture the correct age range.
– Remember that capitalization matters when outputting text.
– Use clear and efficient conditional logic to minimize code redundancy.
Screenshot Examples
How to Use This Prompt
- [age]: variable representing the person’s age.
- [cost]: ticket price based on age category.
- [age < 4]: condition for free tickets.
- [age >= 4 && age <= 12]: condition for $5 tickets.
- [age >= 13 && age <= 19]: condition for $10 tickets (teenagers).
- [age >= 65]: condition for $10 tickets (senior citizens).
- [age >= 20 && age <= 64]: condition for $15 tickets (adults).
- [print]: outputs the age and corresponding cost.
Tips for Best Results
- Free for toddlers: Children under 4 years old get in for free.
- Affordable for kids: Children between 4 and 12 years old pay only $5.
- Teen and senior pricing: Teenagers aged 13-19 and seniors 65+ pay $10.
- Adult ticket cost: Adults aged 20-64 pay $15 for their tickets.
FAQ
- What is the ticket cost for a 1 year old?
Age: 1
Free - How much for a 12 year old ticket?
Age: 12
$5 - What is the cost for a 15 year old?
Age: 15
$10 - What is the ticket price for an 80 year old?
Age: 80
$10
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (February 2026): Initial release.


