Aug-25-2018, 10:06 AM
I have a nested list:
city = [['house', 'street', 'park'], ['car', 'bike', 'train']]Now I want to define a function what takes the first sublist of city as the input (argument) with the variable 'part', what takes the value 0 or 1 (depending on if I want to use the first or the second sublist:
def sublist(city[part]):The editor returns the error:
def sublist(city[part]): ^ SyntaxError: invalid syntaxIs it possible to use a sublist as an argument in python? If yes, how can I do it?