Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
MaherAssaf19 authored Jan 10, 2025
1 parent 51ea6b8 commit 1ab3d32
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions solutions/Travel Planner Fun-Solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
python

Check failure on line 1 in solutions/Travel Planner Fun-Solution.py

View workflow job for this annotation

GitHub Actions / py_linting

Ruff (F821)

solutions/Travel Planner Fun-Solution.py:1:1: F821 Undefined name `python`
import random

Check failure on line 2 in solutions/Travel Planner Fun-Solution.py

View workflow job for this annotation

GitHub Actions / py_linting

Ruff (E402)

solutions/Travel Planner Fun-Solution.py:2:1: E402 Module level import not at top of file

class TravelPlanner:
def __init__(self):
self.destinations = [
"Paris, France",
"Kyoto, Japan",
"Machu Picchu, Peru",
"Cape Town, South Africa",
"New York City, USA",
"Santorini, Greece",
"Cairo, Egypt",
"Sydney, Australia",
"Reykjavik, Iceland",
"Bali, Indonesia"
]
self.activities = [
"exploring ancient ruins",
"dining at a Michelin-star restaurant",
"taking a hot air balloon ride",
"relaxing on a pristine beach",
"hiking through breathtaking trails",
"shopping in local markets",
"attending a cultural festival",
"snorkeling with vibrant marine life",
"enjoying a scenic train ride",
"visiting world-class museums"
]
self.tips = [
"Always pack a portable charger!",
"Learn a few phrases in the local language to impress locals.",
"Carry a reusable water bottle to stay hydrated.",
"Don’t forget travel insurance—it’s a lifesaver!",
"Try street food—it’s often the tastiest and cheapest option.",
"Keep a digital and physical copy of your passport.",
"Research local customs to avoid awkward situations.",
"Pack light—you’ll thank yourself later.",
"Wake up early to enjoy tourist spots without crowds.",
"Always have some local currency on hand for small purchases."
]

def generate_destination(self):
return random.choice(self.destinations)

def generate_activity(self):
return random.choice(self.activities)

def generate_travel_tip(self):
return random.choice(self.tips)

def plan_trip(self):
destination = self.generate_destination()
activity = self.generate_activity()
tip = self.generate_travel_tip()

return {
"destination": destination,
"activity": activity,
"tip": tip
}

def main():
print("Welcome to the Automated Travel Planner! \U0001F30D")
print("Sit back and relax while we plan your next dream trip.\n")

planner = TravelPlanner()
trip = planner.plan_trip()

print(f"\U0001F4CD Destination: {trip['destination']}")
print(f"\U0001F3C3 Activity: {trip['activity']}")
print(f"\U0001F4D6 Travel Tip: {trip['tip']}\n")

print("Your virtual getaway is ready! Safe travels! \U0001F30F")

if __name__ == "__main__":
main()

0 comments on commit 1ab3d32

Please sign in to comment.