-
Notifications
You must be signed in to change notification settings - Fork 457
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
Lesson06 #887
base: master
Are you sure you want to change the base?
Lesson06 #887
Conversation
|
||
# Задача-2: Написать Класс "Равнобочная трапеция", заданной координатами 4-х точек. | ||
# Предусмотреть в классе методы: | ||
# проверка, является ли фигура равнобочной трапецией; | ||
# вычисления: длины сторон, периметр, площадь. | ||
|
||
print("Задача-2") | ||
|
||
class ravtrapetc: |
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.
имена классам даем в CamelCase стиле
import math | ||
len = math.sqrt((self.p2["x"] - self.p1["x"]) ** 2 + (self.p2["y"] - self.p1["y"]) ** 2) | ||
return len | ||
self.C = get_len(self.p1,self.p2) |
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.
неочень хорошая практика создавть атрибуты класса не в методе init, обратите внимание на то что данве строчки в студии подчеркиваются
if A1 == A2: | ||
return True | ||
else: | ||
return False |
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.
можно просто:
return A1 == A2
Выполнил все