I trying to see if there is a more efficient way to write if elif statement. Writing an API to generate a url based on the number of parameters the class is called.
For Ex:
def Cars(self, model=null, color=null, miles=null)
if model == null and color == null and miles ==null:
url = cars/
elif model != null and color == null and miles ==null:
url = cars/model=%s)% model
elif model != null and color != null and miles ==null:
url = cars/model=%s/color=%s)% model, color
else url = someting
return url
I have more than 10 parameters and don't want to write that many elif statements with all the combinations..