Vacation planning exercise

I am unable to understand why in place of arguments in cost_of_trip city[0], city[2]…is being used and how is it working?

def days_to_visit(days):
for city in Cities:
min_cost = min(costs)
return min_cost

Hey, I don’t remember where the code is from, but maybe cities was a list of places, and places (like Paris, etc.) was a list containing data about (flight cost, hotel cost, car rental cost).

So, city in cities iterates over the places list, one by one,
and city[0], city[1], etc. access the cost data in that list which is used to calculate the cost of the trip.

1 Like

Sir mer liye ye bilkul new hai , still muhe smjh nahi aa raha hai , def funcion thoda thoda smjh aa raha to jo apne excesize diya hai wo pura confuse kr rha kuch smjh nahi aa rha hai . kya ye course biggners k liye nahi hai kya jisko python k bare m kuch v nahi pata , please suggest me kyu ki smjh nahi aa raha mujhe kuch. ya mujhe kahi aur se start krna chahiye ?