-
Notifications
You must be signed in to change notification settings - Fork 0
Lab2 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
lab2/main.py
Outdated
most_popular_film = max(self.films, key=lambda x:x['popularity'])['original_title'] | ||
return most_popular_film |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most_popular_film = max(self.films, key=lambda x:x['popularity'])['original_title'] | |
return most_popular_film | |
return max(self.films, key=lambda x:x['popularity'])['original_title'] |
lab2/main.py
Outdated
x = slice(3,19,4) | ||
return self.films[x] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x = slice(3,19,4) | |
return self.films[x] | |
return self.films[slice(3,19,4)] |
everything done
everything done
lab2/main.py
Outdated
"accept": "application/json", | ||
"Authorization": "Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIzMTI3NGFmYTRlNTUyMjRjYzRlN2Q0NmNlMTNkOTZjOSIsInN1YiI6IjVkNmZhMWZmNzdjMDFmMDAxMDU5NzQ4OSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.lbpgyXlOXwrbY0mUmP-zQpNAMCw_h-oaudAJB6Cn5c8" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double-quotes should be replaced with the single one
lab2/main.py
Outdated
return [f['original_title'] for f in self.films if word in f[ | ||
'overview']] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you shouldn't have splited it up for two lines
lab2/main.py
Outdated
answer_collect = frozenset(n for f in self.films for n in f['genre_ids']) | ||
return answer_collect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in one line
lab2/main.py
Outdated
result = [f for f in self.films if int(id_genre_del) not in f['genre_ids']] | ||
return result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in one line
lab2/main.py
Outdated
|
||
def make_collection(self): | ||
result_lst_dic = [self.make_dict(f) for f in self.films] # named tuple | ||
print(result_lst_dic) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete prints please
lab2/main.py
Outdated
@staticmethod | ||
def csv_file_maker(coll_dict): | ||
with open('lab2.txt', mode='w') as csv_file: | ||
fieldnames = ['Title', 'Popularity', 'Score', 'Last_day_in_cinema'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it a constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
сверху вынести константой
with open('lab2.txt', mode='w') as csv_file: | ||
fieldnames = ['Title', 'Popularity', 'Score', 'Last_day_in_cinema'] | ||
writer = csv.DictWriter(csv_file, fieldnames=fieldnames) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary blank line
lab2/main.py
Outdated
from copy import deepcopy | ||
|
||
|
||
# from collections import Counter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you commented it. you definitely use counter in further code
Lab 2 dict films