-
Notifications
You must be signed in to change notification settings - Fork 2
task_2_flat #4
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?
task_2_flat #4
Changes from 2 commits
b64a802
49e2b96
6fe3d91
19dc5dd
4aea48d
068d237
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,82 @@ | ||
| class Flat: | ||
|
|
||
| def __init__(self, kitchen, bedroom, bathroom): | ||
| self.kitchen = kitchen | ||
| self.bedroom = bedroom | ||
| self.bathroom = bathroom | ||
|
|
||
| #def print_rooms(self): | ||
| # print (f'{self.kitchen, self.bedroom, self.bedroom}') | ||
|
|
||
| #def print_flat_size(self, kitchen_size, bedroom_size, bathroom_size): | ||
| # size = self._calculate_flat_size(kitchen_size, bedroom_size, bathroom_size) | ||
| # print(f'Flat {size}sq.m.') | ||
|
|
||
| #def print_kitchen_size(self, size): | ||
| # print(f'{self.kitchen} {size}sq.m.') | ||
|
|
||
| #def print_bedroom_size(self, size): | ||
| # print(f'{self.bedroom} {size}sq.m.') | ||
|
|
||
| #def print_bathroom_size(self, size): | ||
| # print(f'{self.bathroom} {size}sq.m.') | ||
|
|
||
| #def _calculate_flat_size(self, kitchen_size, bedroom_size, bathroom_size): | ||
| # return f'{kitchen_size + bathroom_size + bedroom_size}' | ||
|
Contributor
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. Когда закончите с предыдущими двумя комментариями, можно переходить к этапу 4. Реализуем до конца класс Flat, а именно - добавляем все те методы, которые закомментили: На что обратить внимание?
Contributor
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. Плюс добавляем примеры использования свежесозданных методов: |
||
|
|
||
| #class Room: | ||
|
|
||
| #def __init__(self, name, purpose): | ||
| # self.name = name | ||
| # self.purpose = purpose | ||
|
|
||
| #def __str__(self): | ||
| # return f'{self.name} {self.purpose}' | ||
|
|
||
| #def get_size(self): | ||
| # user_size = input(f'Enter size of {self.name} ') | ||
| # print(f'{self.name} is {user_size}(sq.m.)') | ||
|
|
||
|
|
||
| class Kitchen(Room): | ||
This comment was marked as outdated.
Sorry, something went wrong. |
||
|
|
||
| TITLE = 'Kitchen' | ||
|
|
||
| def __init__(self, size): | ||
|
smartiqa marked this conversation as resolved.
|
||
| self.__size = size | ||
| self.__purpose = 'To eat' | ||
|
|
||
| class Bedroom(Room): | ||
|
|
||
| TITLE = 'Bedroom' | ||
|
|
||
| def __init__(self, size): | ||
| self.__size = size | ||
| self.__purpose = 'To sleep' | ||
|
|
||
| class Bathroom(Room): | ||
|
|
||
| TITLE = 'Bathroom' | ||
|
|
||
| def __init__(self, size): | ||
| self.__size = size | ||
| self.__purpose = 'To wash' | ||
|
|
||
| #class BigBedroom(Room): | ||
|
|
||
| #def __str__(self): | ||
| # return f'{self.name} Спальня с двуспальной кроватью' | ||
|
|
||
| #class GuestBedroom(Room): | ||
|
|
||
| #def __str__(self): | ||
| # return f'{self.name} Гостевая спальня' | ||
|
|
||
|
|
||
| my_kitchen = Kitchen(13) | ||
|
|
||
| my_bedroom = Bedroom(18) | ||
|
|
||
| my_bathroom = Bathroom(4) | ||
|
|
||
| my_flat = Flat(my_kitchen, my_bedroom, my_bathroom) | ||
Uh oh!
There was an error while loading. Please reload this page.