Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0f1e138
basic_exercises part 1
Feb 20, 2023
1c8d7d0
basic_exercises fixed
Feb 22, 2023
88169bb
basic_exercises fixed_1
Feb 22, 2023
190192d
add string_challenges.py, for_challenges.py fixed
Feb 23, 2023
85ef5fb
add for_dict_challenges.py
Feb 25, 2023
c27c417
for_challenges.py, string_challenges.py fixed
Feb 25, 2023
dd92056
add task company.py solution
Feb 26, 2023
c63c919
add task company.py solution
Feb 26, 2023
b3ba249
company.py fixed, add additional tasks
Feb 27, 2023
867a711
fixed compane.py
Feb 28, 2023
991276a
fixed company.py, for_dict_challenges.py +last task
Mar 1, 2023
7ff8a37
fixed company.py
Mar 3, 2023
1a2b535
fixed for_dict_challenges.py, except for the 5 task
Mar 3, 2023
d7696ae
fixed company.py, for_dict_challenges.py
Mar 4, 2023
1a9d3bc
fixed for_challenges.py, string_challenges.py
Mar 4, 2023
2c3c060
correcting remarks code review company.py, for_dict_challenges.py
Mar 5, 2023
0563d48
add task 13, 14 company
Mar 6, 2023
f4da86c
correcting task 13, add functions
Mar 9, 2023
9b7131c
fixed 13, 14 tasks
Mar 11, 2023
0b79ba6
Исправил замечания, добавил решения задач 16,17,18
Mar 18, 2023
7598ae9
Решение 1 задачи в for_dict_challenges_bonus.py
Mar 18, 2023
fb5366d
исправление замечаний review
Mar 19, 2023
191c915
исправление замечаний, немного поменял алгоритм
Mar 19, 2023
3cc58b3
fixing the mistakes according to the comments
Mar 21, 2023
3aa9ea8
Решение 2 задачи \for_dict_challenges_bonus.py
Mar 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions company.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@
for department in departments:
for employer in department['employers']:
if employer['salary_rub'] > task_salary:
print(f'Заработная плата {employer["first_name"]} превышает 100К')
print(f'Заработная плата {employer["first_name"]} превышает {task_salary}К')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Теперь K из принта надо убрать, а то получается, что там теперь 100000к. Аналогично принтами ниже.


task_salary = 80000 # task 5
for department in departments:
for employer in department['employers']:
if employer['salary_rub'] < task_salary:
print(f'Заработная плата {employer["position"]} ниже 80К')
print(f'Заработная плата {employer["position"]} ниже {task_salary}К')

for department in departments: # task 6
department_salary = 0
Expand Down Expand Up @@ -98,7 +98,7 @@
for employer in department['employers']:
if employer['salary_rub'] > task_salary:
salary_cap.append(employer["position"])
print(f'{", ".join(salary_cap)} получают больше 90К')
print(f'{", ".join(salary_cap)} получают больше {task_salary}К')

girls = ['Michelle', 'Nicole', 'Christina', 'Caitlin'] # task 11
for department in departments:
Expand All @@ -116,6 +116,3 @@
end_vowel_letter_in_last_name.append(employer["first_name"])
end_vowel_letter_in_last_name_set = set(end_vowel_letter_in_last_name)
print(f'Фамилии сотрудников {", ".join(end_vowel_letter_in_last_name_set)} оканчиваются на гласную букву')



23 changes: 18 additions & 5 deletions for_dict_challenges.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
]

def max_name(students):
name_of_students = [students[name]['first_name'] for name in range(len(students))]
name_of_students = [student['first_name'] for student in students]

names_counter = dict()
for name in name_of_students:
Expand Down Expand Up @@ -118,7 +118,6 @@ def max_name(students):
school = [
{'class': '2a', 'students': [{'first_name': 'Маша'}, {'first_name': 'Оля'}]},
{'class': '3c', 'students': [{'first_name': 'Олег'}, {'first_name': 'Миша'}]},
{'class': '4c', 'students': [{'first_name': 'Олег'}, {'first_name': 'Миша'}, {'first_name': 'Миша'}]},
]
is_male = {
'Маша': False,
Expand All @@ -127,6 +126,11 @@ def max_name(students):
'Миша': True,
}

max_male_class = ''
max_female_class = ''

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пока у тебя нет таких классов, в эти переменные стоит записывать None – его в пайтоне как раз для этого и придумали.

max_male_gender = 0
max_female_gender = 0

for students in school:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут не students, тут класс типа.

male_gender = 0
female_gender = 0
Expand All @@ -135,6 +139,15 @@ def max_name(students):
male_gender += 1
else:
female_gender += 1
boys_predominate = 'Больше всего мальчиков в классе '
girls_predominate = 'Больше всего девочек в классе '
print(f'{boys_predominate}{students["class"]}') if male_gender > female_gender else print(f'{girls_predominate}{students["class"]}')
if male_gender > female_gender:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Кажется, у этого ифа лишний отступ

max_male_gender = male_gender
max_male_class = str(students["class"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

students["class"] и так строка, не надо её ещё раз превращать в строку.

if male_gender > max_male_gender:
max_male_gende = male_gender
else:
max_female_gender = female_gender
max_female_class = str(students["class"])
if female_gender > max_female_gender:
max_female_gender = female_gender
print(f'Больше всего мальчиков в классе {max_male_class}')
print(f'Больше всего девочек в классе {max_female_class}')