This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def recurs_flatten(lista): | |
result = [] | |
for item in lista: | |
if type(item) == type([]): | |
result.extend(recurs_flatten(item)) | |
else: | |
result.append(item) | |
return result | |
# TESTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product(): | |
def __init__(self,name,continent,country,city): | |
self._name=name | |
self._continent=continent | |
self._country=country | |
self._city=city | |
def get_location(self): | |
return [self._continent,self._country,self._city] |