Skip to content

Commit 4cf4d44

Browse files
Feat: Added main.py (runs Travel Itinerary Planner app) and README.md template.
1 parent 5675c6d commit 4cf4d44

2 files changed

Lines changed: 130 additions & 0 deletions

File tree

Travel Itinerary Planner/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Script Name
2+
Short description of package/script
3+
- If package, list of functionalities/scripts it can perform
4+
- If standalone script, short description of script explaining what it achieves
5+
6+
# Description
7+
- If code is not explainable using comments, use this sections to explain your script
8+
9+
# Prerequisites
10+
- Python 3.14
11+
- pip (Python package installer)
12+
- Git Bash
13+
- (List out the libraries imported in the script)
14+
15+
# Installing instructions
16+
1. Clone the repository to your local machine
17+
```bash
18+
git clone https://github.com/king04aman/All-In-One-Python-Projects.git
19+
```
20+
2. Change directory into the cloned repository
21+
```bash
22+
cd All-In-One-Python-Projects/'Travel Itinerary Planner'/
23+
```
24+
3. Install the required libraries
25+
```bash
26+
pip install -r requirements.txt
27+
```
28+
4. Run the program using
29+
```bash
30+
python3 main.py
31+
```
32+
33+
# Screenshot
34+
- Display images/gifs/videos of output/result of your script so that users can visualize it.
35+
36+
# Author
37+
Gabrielle Allan

Travel Itinerary Planner/main.py

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
from src.manage_itineraries import add_itinerary, edit_itinerary, view_itineraries, delete_itinerary, export_itinerary
2+
from pick import pick
3+
4+
5+
def user_task_request(request, itinerary_list):
6+
'''
7+
Executes a specific request based on user's choice.
8+
'''
9+
# Add a new itinerary
10+
if request == "1":
11+
flights_list_done = False
12+
attractions_list_done = False
13+
print("How exciting! Please provide us information about the trip: \n")
14+
name = input("Title of the itinerary: ")
15+
location = input("Location (NA if not applicable): ")
16+
summary = input("Brief description of trip: ")
17+
start_date = input("Start date in DD-MM-YYYY: ")
18+
end_date = input("End date in DD-MM-YYYY: ")
19+
while not flights_list_done:
20+
# Answer format: Perth-Sydney 12-12-2012, Sydney-Perth 21-12-2012
21+
flights = input("") # dictionary - add loop here
22+
if flights == "DONE":
23+
flights_list_done = True
24+
while not attractions_list_done:
25+
attractions = input("") # dictionary - add loop here
26+
if attractions == "DONE":
27+
attractions_list_done = True
28+
add_itinerary(itinerary_list, name, location, summary, start_date, end_date, flights, attractions)
29+
pass
30+
31+
# Edit existing itinerary
32+
elif request == "2":
33+
# Use pickpack module (https://github.com/anafvana/pickpack#map-function-for-nested-lists)
34+
pass
35+
36+
# View itinerary
37+
elif request == "3":
38+
view_itineraries(itinerary_list)
39+
pass
40+
41+
# Delete itinerary
42+
elif request == "4":
43+
delete_itinerary(itinerary_list)
44+
pass
45+
46+
elif request == "5":
47+
# Export to .csv file?
48+
# Use pick (not pickpack) library to list itineraries by name and location
49+
export_itinerary(itinerary_list)
50+
pass
51+
52+
else:
53+
print("Invalid answer, please type a number between 1-5.")
54+
pass
55+
56+
57+
def run_app():
58+
"""
59+
Main loop to run the travel planner.
60+
"""
61+
itineraries = []
62+
app_running = True
63+
64+
while app_running:
65+
print("Welcome to the Travel Itinerary Planner app!\n")
66+
print("1. Add a new Itinerary")
67+
print("2. Edit an existing Itinerary")
68+
print("3. View existing Itineraries")
69+
print("4. Delete an Itinerary")
70+
print("5. Export an Itinerary")
71+
print("6. Log out\n")
72+
73+
user_choice = input("Please select one of the above options (1-5): ")
74+
75+
# Check user_choice was a number
76+
if user_choice.isdigit():
77+
choice = int(user_choice)
78+
if 1 <= choice <= 6:
79+
if user_choice == "6":
80+
app_running = False
81+
else:
82+
user_task_request(user_choice, itineraries)
83+
else:
84+
print("Enter a number between 1-6.")
85+
else:
86+
("Invalid input: Please enter a number between 1-6.")
87+
88+
print("See you next time! 👋")
89+
pass
90+
91+
92+
if __name__ == "__main__":
93+
run_app()

0 commit comments

Comments
 (0)