Skip to content Skip to sidebar Skip to footer

Write A Function That Makes Another Function Returns A List Instead Of Function

This are previously defined functions def make_service(service_data, service_code): routes = [] directions = list(set(map(lambda entry: entry[1], service_data))) #['1',

Solution 1:

make_service returns a simple lambda function with one argument; t. This lambda function in turn returns either:

  • service_code (t==0);
  • directions (t==1); or
  • routes (any other value of t).

Therefore once you have this function you can access any of these values by providing the appropriate argument, e.g.

106_service_code = service_106(0)

Post a Comment for "Write A Function That Makes Another Function Returns A List Instead Of Function"