-
Notifications
You must be signed in to change notification settings - Fork 0
Лабораторная работа 1 #2
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| numbers = [2, -93, -2, 8, None, -44, -1, -85, -14, 90, -22, -90, -100, -8, 38, -92, -45, 67, 53, 25] | ||
|
|
||
| # TODO заменить значение пропущенного элемента средним арифметическим | ||
| missing_item_index = 4 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GOODОтличное решение завести переменную, а не пользоваться магическими числами! Заведя переменную и заполнив её на первом этапе вручную, можно в будущем доработать так, чтобы эта переменная вычислялась автоматизированно. |
||
| new_numbers = numbers[:missing_item_index] + numbers[missing_item_index + 1:] # Список чисел без пропуска | ||
| avg_numbers = sum(new_numbers) / len(numbers) # Среднее арифметическое списка numbers | ||
| numbers[missing_item_index] = avg_numbers | ||
| print("Измененный список:", numbers) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 0.5 балла |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # TODO Найдите количество книг, которое можно разместить на дискете | ||
| CHAR_SIZE = 4 # Размер одного символа в байтах | ||
|
|
||
| floppy_capacity_space_mb = 1.44 # Объем дискеты в Мб | ||
| book_page_count = 100 # Количество страниц в книге | ||
| lines_per_page = 50 # Число строк на странице | ||
| characters_in_line = 25 # Количество символов в строке | ||
|
|
||
| characters_in_book = book_page_count * lines_per_page * characters_in_line # Количество симовлов в книге | ||
|
|
||
| book_size_bytes = characters_in_book * CHAR_SIZE # Размер книги в байтах | ||
| floppy_capacity_space_bytes = floppy_capacity_space_mb * 1024 * 1024 # Объем дискеты в байтах | ||
|
|
||
| book_on_floppy = int(floppy_capacity_space_bytes / book_size_bytes) | ||
|
|
||
| print("Количество книг, помещающихся на дискету:", book_on_floppy) |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 0.5 балла |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| list_players = ["Маша", "Петя", "Саша", "Оля", "Кирилл", "Коля"] | ||
|
|
||
| # TODO Разделите участников на две команды | ||
| count_players = len(list_players) # Количество игроков | ||
| middle_index = count_players // 2 # Индекс игрока посередине списка | ||
|
|
||
| print(list_players[:middle_index]) | ||
| print(list_players[middle_index:]) |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 0.5 балла |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| users = ['user1', 'user2', 'user3', 'user1', 'user4', 'user2'] | ||
|
|
||
| # TODO Добавьте словарь и замените в нем нулевые значения статисчикой посещений | ||
| site_visit_statistics = { | ||
| "Общее количество": 0, | ||
| "Уникальные посещения": 0 | ||
| } | ||
|
|
||
| site_visit_statistics["Общее количество"] = len(users) | ||
| site_visit_statistics["Уникальные посещения"] = len(set(users)) | ||
|
|
||
| print(site_visit_statistics) |
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.
1 балл