get_packing_list.get_packing_list

get_packing_list.get_packing_list(weather, duration)

Create a packing list from weather and trip duration.

Parameters

Name Type Description Default
weather str Expected conditions (e.g., “cold”, “warm”, “rainy”). required
duration int Total number of days for the trip. required

Returns

Name Type Description
list Base items first, then additions based on weather and trip length.

Raises

Name Type Description
ValueError If duration is less than 1 with message “Trip duration must be at least 1 day.”.

Notes

Base items are [“Passport”, “Toothbrush”]. Add “Heavy Jacket” and “Gloves” for cold, “Umbrella” for rainy, “Sunscreen” for warm, and “Laundry kit” if duration > 7.

Examples

>>> get_packing_list("cold", 3)
['Passport', 'Toothbrush', 'Heavy Jacket', 'Gloves']
>>> get_packing_list("rainy", 10)
['Passport', 'Toothbrush', 'Umbrella', 'Laundry kit']