You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Executes a specific request based on user's choice.
8
-
'''
9
-
# Add a new itinerary
10
-
ifrequest=="1":
11
-
flights_list_done=False
12
-
attractions_list_done=False
13
-
14
-
print("How exciting! Please provide us information about the trip: \n")
15
-
name=input("Title of the itinerary: ")
16
-
location=input("Location (NA if not applicable): ")
17
-
summary=input("Brief description of trip: ")
18
-
start_date=input("Start date in DD-MM-YYYY: ")
19
-
end_date=input("End date in DD-MM-YYYY: ")
20
-
flights= {}
21
-
attractions= {}
22
-
23
-
print("\nNow it is time to add flights!")
24
-
user_flight_choice=input("If you want to skip this step, type SKIP and press 'Enter'. Otherwise, press 'Enter'. ")
25
-
flights_list_done=False
26
-
27
-
ifuser_flight_choice=="SKIP":
28
-
flights= {}
29
-
else:
30
-
whilenotflights_list_done:
31
-
flight_details= {}
32
-
33
-
departure_airport=input("Name of the airport you will depart from: ")
34
-
departure_date=input("Date & time of flight departure (Format: DD-MM-YYYY HH:MM): ")
35
-
arrival_airport=input("Name of the airport you will arrive at: ")
36
-
arrival_date=input("Date & time of flight arrival (Format: DD-MM-YYYY HH:MM): ")
37
-
flight_name=f"{departure_airport} to {arrival_airport}"
38
-
39
-
flight_details.update({
40
-
"departure airport": departure_airport,
41
-
"departure date": departure_date,
42
-
"arrival airport": arrival_airport,
43
-
"arrival date": arrival_date
44
-
})
45
-
flights[flight_name] =flight_details
46
-
47
-
add_another_flight=input("Would you like to add another flight? Type Y (yes) or N (no): ")
48
-
whileTrue:
49
-
ifadd_another_flight=="Y":
50
-
flights_list_done=True
51
-
break
52
-
elifadd_another_flight=="N":
53
-
flights_list_done=False
54
-
break
55
-
else:
56
-
print("Invalid answer: Please type Y or N only.")
57
-
58
-
print("\nFinally: ATTRACTIONS!")
59
-
user_attractions_choice=input("If you want to skip this step, type SKIP and press 'Enter'. Otherwise, press 'Enter'. ")
60
-
attractions_list_done=False
61
-
62
-
ifuser_attractions_choice=="SKIP":
63
-
attractions= {}
64
-
else:
65
-
whilenotattractions_list_done:
66
-
attraction_details= {}
67
-
68
-
attraction_name=input("Name of attraction: ")
69
-
attraction_address=input("Address of attraction: ")
70
-
attraction_summary=input("Short description of attraction: ")
71
-
attraction_type=input("(Optional) Provide some tags that categorise what kind of activity this involves.\nExample of format required: hike, exciting, views\n")
72
-
attraction_tags=attraction_type.split(", ")
73
-
74
-
attraction_details.update({
75
-
"address": attraction_address,
76
-
"summary": attraction_summary,
77
-
"tag(s)": attraction_tags
78
-
})
79
-
attractions[attraction_name] =attraction_details
80
-
81
-
add_another_attraction=input("Would you like to add another attraction? Type Y or N:")
user_choice=input("Please select one of the above options (1-5): ")
18
+
print("5. Log out\n")
141
19
142
20
# Check user_choice was a number
143
-
ifuser_choice.isdigit():
144
-
choice=int(user_choice)
145
-
if1<=choice<=6:
146
-
ifuser_choice=="6":
147
-
app_running=False
21
+
whileTrue:
22
+
user_choice=input("Please select one of the above options (1-5): ")
23
+
ifuser_choice.isdigit():
24
+
choice=int(user_choice)
25
+
if1<=choice<=5:
26
+
break
148
27
else:
149
-
user_task_request(user_choice, itineraries)
28
+
print("Enter a number between 1-5.")
29
+
else:
30
+
("Invalid input: Please enter a number between 1-5.")
31
+
32
+
# Add a new itinerary
33
+
ifuser_choice=="1":
34
+
flights_list_done=False
35
+
attractions_list_done=False
36
+
37
+
print("How exciting! Please provide us information about the trip: \n")
38
+
name=input("Title of the itinerary: ")
39
+
location=input("Location (NA if not applicable): ")
40
+
summary=input("Brief description of trip: ")
41
+
start_date=input("Start date in DD-MM-YYYY: ")
42
+
end_date=input("End date in DD-MM-YYYY: ")
43
+
flights= {}
44
+
attractions= {}
45
+
46
+
print("\nNow it is time to add flights!")
47
+
user_flight_choice=input("If you want to skip this step, type SKIP and press 'Enter'. Otherwise, press 'Enter'. ")
48
+
flights_list_done=False
49
+
50
+
ifuser_flight_choice=="SKIP":
51
+
flights= {}
52
+
else:
53
+
whilenotflights_list_done:
54
+
flight_details= {}
55
+
56
+
departure_airport=input("Name of the airport you will depart from: ")
57
+
departure_date=input("Date & time of flight departure (Format: DD-MM-YYYY HH:MM): ")
58
+
arrival_airport=input("Name of the airport you will arrive at: ")
59
+
arrival_date=input("Date & time of flight arrival (Format: DD-MM-YYYY HH:MM): ")
60
+
flight_name=f"{departure_airport} to {arrival_airport}"
61
+
62
+
flight_details.update({
63
+
"departure airport": departure_airport,
64
+
"departure date": departure_date,
65
+
"arrival airport": arrival_airport,
66
+
"arrival date": arrival_date
67
+
})
68
+
flights[flight_name] =flight_details
69
+
70
+
whileTrue:
71
+
add_another_flight=input("Would you like to add another flight? Type Y (yes) or N (no): ")
72
+
ifadd_another_flight=="Y":
73
+
flights_list_done=False
74
+
break
75
+
elifadd_another_flight=="N":
76
+
flights_list_done=True
77
+
break
78
+
else:
79
+
print("Invalid answer: Please type Y or N only.")
80
+
81
+
print("\nFinally: ATTRACTIONS!")
82
+
user_attractions_choice=input("If you want to skip this step, type SKIP and press 'Enter'. Otherwise, press 'Enter'. ")
83
+
attractions_list_done=False
84
+
85
+
ifuser_attractions_choice=="SKIP":
86
+
attractions= {}
150
87
else:
151
-
print("Enter a number between 1-6.")
152
-
else:
153
-
("Invalid input: Please enter a number between 1-6.")
88
+
whilenotattractions_list_done:
89
+
attraction_details= {}
90
+
91
+
attraction_name=input("Name of attraction: ")
92
+
attraction_address=input("Address of attraction: ")
93
+
attraction_summary=input("Short description of attraction: ")
94
+
attraction_type=input("(Optional) Provide some tags that categorise what kind of activity this involves.\nExample of format required: hike, exciting, views\n")
95
+
attraction_tags=attraction_type.split(", ")
96
+
97
+
attraction_details.update({
98
+
"address": attraction_address,
99
+
"summary": attraction_summary,
100
+
"tag(s)": attraction_tags
101
+
})
102
+
attractions[attraction_name] =attraction_details
103
+
104
+
whileTrue:
105
+
add_another_attraction=input("Would you like to add another attraction? Type Y or N:")
0 commit comments