Learn practical skills, build real-world projects, and advance your career
Updated 2 years ago
my-practice
Use the "Run" button to execute the code.
!pip install jovian --upgrade --quiet
import jovian
# Execute this to save new versions of the notebook
jovian.commit(project="my-practice")
import math
def vac(budget,duration=100):
loc=[['Paris',200,20,200],['London',250,30,120],['Dubai',370,15,80],['Mumbai',450,10,70]]
price=0
finprice=0
maxdur=0
best=0
index=-1;
index1=-1;
worst=1000
for i in loc:
finprice=0
maxdur=0
for dur in range(1,duration):
price=math.ceil(i[1]+i[2]*dur+i[3]*math.ceil(dur/7))
if(price<=budget and price>=finprice):
finprice=price
maxdur=dur
i.append(maxdur)
i.append(finprice)
if(best<i[4]):
best=i[4];
index=i;
if(worst>i[4]):
worst=i[4];
index1=i;
return index,index1;