Skip to content

Lesson5 - #5

Open
pmalibor wants to merge 33 commits into
mainfrom
lesson5
Open

Lesson5#5
pmalibor wants to merge 33 commits into
mainfrom
lesson5

Conversation

@pmalibor

Copy link
Copy Markdown
Owner

Homeworks for the lesson5 : files

pmal6 added 30 commits January 14, 2022 13:01
Comment thread lesson5/2_lesson5.py Outdated
# my_f.readlines - это список типа ['lkjlk', 'owiuoiu', 'kjhkjh', ], где элементы - строки
# из файла

print(len(my_f.readlines())) # с помощью функции len() подсчитываем число элементов в списке

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

В этом варианте решение забыли посчитать еще количество слов в каждой строке

Comment thread lesson5/4_lesson5.py
# в которой удалены элементы справа с помощью метода rstrip
# и символ "-" - с помощью метода split('-')

file_write.write(f'{eng_rus_dictionary[text_num]} - {num}\n') # формируем файл с переводом file_write

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

можно еще через replace сделать

Comment thread lesson5/6_lesson5.py
print(lesson_counter)
target_dictionary.update({lesson_name.rstrip(":"): sum(lesson_counter)})

print(target_dictionary)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

похоже на решение с разбора

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants