-
Notifications
You must be signed in to change notification settings - Fork 0
Sprint_1 #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
Open
Based96
wants to merge
5
commits into
main
Choose a base branch
from
develop
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Sprint_1 #1
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0a2362a
выполнил задание 1, добавил файл task_1.py
d879244
Выполнил задание 2. Загрузил файл task_2.py
79b6a67
выполнено задание 3. добавлен файл task_3.py
51dc3c6
выполнил задание 4. добавил файл tast_4.py
093334e
выполнил задание 5. добавил файл task_5.py
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Нам дано время по задаче | ||
| times = '1h 45m,360s,25m,30m 120s,2h 60s' | ||
|
|
||
| time_list = times.split(',') | ||
| total_minutes = 0 | ||
|
|
||
| for time_str in time_list: | ||
| parts = time_str.split() | ||
| for part in parts: | ||
| if 'h' in part: | ||
| hours = int(part.replace('h', '')) | ||
| total_minutes += hours * 60 | ||
| elif 'm' in part: | ||
| minutes = int(part.replace('m', '')) | ||
| total_minutes += minutes | ||
| elif 's' in part: | ||
| seconds = int(part.replace('s', '')) | ||
| total_minutes += seconds // 60 | ||
|
|
||
| print(f'Общее количество минут: {total_minutes}') | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| class Tester: | ||
|
|
||
| def __init__(self, name): | ||
| self.name = name | ||
| self.deadline = True | ||
|
|
||
| def work_hard(self, deadline=True): | ||
| if deadline: | ||
| print(self.name, 'Что ж, ещё часок поработаю!') | ||
| else: | ||
| print(self.name, 'Можно отдыхать') | ||
|
|
||
| tester_1 = Tester(name='tester_1') | ||
| tester_1.work_hard(deadline=False) # 'tester_1 Можно отдыхать' | ||
| tester_2 = Tester(name='tester_2') | ||
| tester_2.work_hard(deadline=True) # 'tester_2 Что ж, ещё часок поработаю!' | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| world_champions = { | ||
| 2002: 'Бразилия', | ||
| 2006: 'Италия', | ||
| 2010: 'Испания', | ||
| 2014: 'Германия', | ||
| 2018: 'Франция', | ||
| } | ||
|
|
||
| world_champions[2022] = 'Англия' | ||
|
|
||
| for year, country in world_champions.items(): | ||
| print(f'{year} - {country}') | ||
|
|
||
| country = 'Италия' | ||
|
|
||
| if country in world_champions.values(): | ||
| print(f'{country} становилась чемпионом мира по футболу в 21 веке!') | ||
| else: | ||
| print(f'{country} не выиграла чемпионат мира по футболу в 21 веке!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| new_tasks = ['task_001', 'task_011', 'task_007', 'task_015', 'task_005'] | ||
| completed_tasks = ['task_002', 'task_012', 'task_006'] | ||
|
|
||
| completed_tasks.append(new_tasks.pop(new_tasks.index('task_005'))) | ||
|
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. Отлично: получилось сделать цепочку команд и решить несколько задач одной строкой |
||
|
|
||
| new_tasks.remove('task_007') | ||
|
|
||
| print(new_tasks[-1]) #По заданию написано вывести только условия п.3, изменения п.1-2 не вывожу | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| class TestCase: | ||
|
|
||
| def __init__(self): | ||
| self.steps = {} | ||
| self.result = None | ||
|
|
||
| def set_step(self, step_number, step_text): | ||
| self.steps[step_number] = step_text | ||
|
|
||
| def delete_step(self, step_number): | ||
| if step_number in self.steps: | ||
| del self.steps[step_number] | ||
|
|
||
| def set_result(self, result): | ||
| self.result = result | ||
|
|
||
| def get_test_case(self): | ||
| test_case_info = { | ||
| 'Шаги': self.steps,'Ожидаемый результат': self.result} | ||
| print(test_case_info) | ||
|
|
||
| test_case_1 = TestCase() | ||
| test_case_1.set_step(1, 'Перейти на сайт') | ||
| test_case_1.set_step(3, 'Перейти в раздел Товары') | ||
| test_case_1.delete_step(3) | ||
| test_case_1.set_step(2, 'Перейти в раздел Товары') | ||
| test_case_1.set_step(3, 'Нажать кнопку «В корзину» у первого товара') | ||
| test_case_1.set_result('Товар окажется в корзине') | ||
| test_case_1.get_test_case() | ||
|
|
||
| test_case_2 = TestCase() | ||
| test_case_2.set_step(1, 'Перейти на сайт') | ||
| test_case_2.set_step(2, 'Перейти в раздел Корзина') | ||
| test_case_2.set_step(3, 'Нажать кнопку "Удалить"') | ||
| test_case_2.set_result('Товар удален из корзины') | ||
| test_case_2.get_test_case() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Можно лучше: тут присутствует дублирование назначения True для deadline