Skip to content

added task1(homework5)#5

Merged
coldalbard merged 5 commits intomainfrom
homework5
Mar 6, 2023
Merged

added task1(homework5)#5
coldalbard merged 5 commits intomainfrom
homework5

Conversation

@coldalbard
Copy link
Copy Markdown
Owner

No description provided.


a = int(input("Please enter the number A: "))
b = int(input("Please enter the number B: "))
def Degree(a, b):
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 on lines +12 to +13
b -= 1
return a * Degree(a, b)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Это можно сократить

Suggested change
b -= 1
return a * Degree(a, b)
return a * Degree(a, b - 1)

b -= 1
return a * Degree(a, b)
return a
print(f'{a}^{b} = {Degree(a, b)}')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Что-то не так
image
image

a = int(input("Please enter the number A: "))
b = int(input("Please enter the number B: "))
def SumNumbers(a, b):
if 0 == b:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Обычно записывают не так.

Suggested change
if 0 == b:
if b == 0:

if 0 == b:
return a
return SumNumbers(a + 1, b - 1)
print(f'{a} + {b} = {SumNumbers(a, b)}')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Принято

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Все понял, спасибо

@coldalbard coldalbard merged commit 9018fc5 into main Mar 6, 2023
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