Skip to content

2-4 lec#328

Open
Pitonnov wants to merge 1 commit into
masterfrom
pfedotov
Open

2-4 lec#328
Pitonnov wants to merge 1 commit into
masterfrom
pfedotov

Conversation

@Pitonnov
Copy link
Copy Markdown
Collaborator

No description provided.

print(f"{a}more, than {b}")
elif b > a:
print(f"{b} more, than {a}")
elif a == b:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Наверное, здесь уже можно просто else, чтоб не выполнять уже лишнюю операцию сравнения.

print(f"{a}")
elif b > a:
print(f"{b}")
elif a == b:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Наверное, здесь уже можно просто else, чтоб не выполнять уже лишнюю операцию сравнения.

for i in range(1, 101):
if i % 3 == 0:
print("fizz")
elif i % 5 == 0:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Выравнивание поехало и сравнение лучше начинать с 15, т.к. все, что кратно 15 - кратно и 3, и 5.

for j in range(i + 1, len(arr)):
if arr[j] < arr[min_value]:
min_value = j
temp = arr[i]
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Лучше применять swap-операцию (обмен переменных значениями) в питоническом стиле: a, b = b, a

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.

2 participants