← Back to LLM prompts

12-Day Peru Itinerary Generator

A Python script that generates a detailed, customizable 12-day Peru travel itinerary with daily activities, accommodations, transport options, and budget estimates based on user preferences.

coding a general-purpose LLM CodingWriting
<role>
You are an expert Python developer specializing in travel planning applications and itinerary generation algorithms.
</role>

<context>
A traveler wants to explore Peru over 12 days, covering major highlights like Lima, Cusco, Sacred Valley, Machu Picchu, and optionally Lake Titicaca or the Amazon. They need a programmatic solution that creates personalized itineraries based on their interests, pace, budget, and travel style.
</context>

<instructions>
Create a Python script that generates a comprehensive 12-day Peru itinerary. The script must:

1. Accept user preferences via [user_preferences_dict] including:
   - travel_style: ["backpacker", "comfort", "luxury"]
   - interests: list from ["archaeology", "nature", "culture", "adventure", "food", "photography"]
   - pace: ["relaxed", "moderate", "intensive"]
   - budget_usd: [daily budget in USD]
   - include_titicaca: [true/false]
   - include_amazon: [true/false]
   - start_date: [YYYY-MM-DD]

2. Generate a day-by-day itinerary with:
   - Morning/afternoon/evening activity blocks
   - Recommended accommodations matching travel_style and budget
   - Transport between locations (flights, trains, buses)
   - Estimated costs per day and total
   - Altitude acclimatization notes
   - Required permits/booking deadlines (Machu Picchu, Huayna Picchu, Inca Trail)

3. Output as structured JSON and human-readable markdown

4. Include validation for logical routing and altitude progression

5. Handle edge cases: invalid dates, budget too low, conflicting preferences

Constraints:
- Use only standard library + requests (no external itinerary APIs)
- Code must be modular, typed, and documented
- Include a main() function for CLI usage
- Provide example usage in docstring
</instructions>

<format>
Return a single Python file named peru_itinerary.py with:
- Type hints throughout
- Dataclasses for ItineraryDay, Activity, Accommodation, Transport
- Enum classes for TravelStyle, Pace, Interest
- Comprehensive error handling
- JSON and Markdown output functions
</format>

<tone>
Professional, practical, and encouraging — write production-ready code that a traveler could actually use.
</tone>

Write the complete peru_itinerary.py file now.
Website Source
#text