From 73ecd7d386ae14cca80c83154e18fa065c5b125f Mon Sep 17 00:00:00 2001 From: Crai-cry Date: Sun, 29 Mar 2026 21:40:25 +0300 Subject: [PATCH] finished work --- answer/1try.txt | 1 + vacancy_analyzer.py | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 answer/1try.txt diff --git a/answer/1try.txt b/answer/1try.txt new file mode 100644 index 0000000..6ceefd3 --- /dev/null +++ b/answer/1try.txt @@ -0,0 +1 @@ +ID 2: Data Engineer в Тинькофф, Москва — от 180000 до 250000ID 6: Senior Python Developer в Wildberries, Москва — от 200000 до 300000 \ No newline at end of file diff --git a/vacancy_analyzer.py b/vacancy_analyzer.py index dae1384..0a8f1ff 100644 --- a/vacancy_analyzer.py +++ b/vacancy_analyzer.py @@ -56,7 +56,7 @@ def format_vacancy_short(vacancy: dict) -> str: else: salary_str = "зарплата не указана" return (f"ID {vacancy.get('id')}: {vacancy.get('title')} в {vacancy.get('company')}, " - f"{vacancy.get('city')} — {salary_str}") + f"{vacancy.get('city')} — {salary_str}\n") def save_filtered_results(vacancies: list[dict], filename: str) -> bool: try: with open(filename,"w") as file: @@ -73,13 +73,17 @@ def main(): filered_vacancies=filter_by_skills(filered_vacancies,skils_list) filered_vacancies = filter_by_salary(filered_vacancies,int(input("Write salary: "))) print("Уникальные компании: ", ", ".join(extract_unique_companies(filered_vacancies))) - - - - - - - + top_skills = extract_top_skills(filered_vacancies, 5) + print(f"Топ-5 навыков:") + for skill, count in top_skills: + print(f" {skill}: {count} вакансий") + print(f"\nСредняя зарплата: {calculate_average_salary(filered_vacancies):,.0f} руб.") + for company, count in group_by_company(filered_vacancies).items(): + print(f" {company}: {count} вакансий") + if(save_filtered_results(filered_vacancies,input("Write where to save"))): + print("Check your path") + else: + print("Everything is fine, the file is saved") if __name__ =="__main__": #вход проги main() \ No newline at end of file