class in python
class LuckyLemur(): def __init__(self, description): self.description = description def reveal_description(self): print(f'Lucky Lemur is {self.description}') lucky_lemur = LuckyLemur('Pro') lucky_lemur.reveal_description()
class in python
class LuckyLemur(): def __init__(self, description): self.description = description def reveal_description(self): print(f'Lucky Lemur is {self.description}') lucky_lemur = LuckyLemur('Pro') lucky_lemur.reveal_description()
@methodclass in python
class Date(object): def __init__(self, day=0, month=0, year=0): self.day = day self.month = month self.year = year @classmethod def from_string(cls, date_as_string): day, month, year = map(int, date_as_string.split('-')) date1 = cls(day, month, year) return date1 @staticmethod def is_date_valid(date_as_string): day, month, year = map(int, date_as_string.split('-')) return day <= 31 and month <= 12 and year <= 3999 date2 = Date.from_string('11-09-2012') is_date = Date.is_date_valid('11-09-2012')
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us