Last active
May 23, 2021 15:32
-
-
Save chhantyal/e02c9af0a6d0f4302f8a219374aa6626 to your computer and use it in GitHub Desktop.
Baby abbouncement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from dataclasses import dataclass | |
@dataclass | |
class Baby: | |
name: str | |
birthday: str | |
mother: str = "Mother's name" | |
father: str = "Father's name" | |
family_name: str = "Family name" | |
@staticmethod | |
def greeting(): | |
print("Hello World!") | |
def get_fullname(self): | |
return f"{self.name} {self.family_name}" | |
def introduce(self): | |
print(f"My name is {self.get_fullname()}. I was born on {self.birthday}.") | |
if __name__ == "__main__": | |
newborn = Baby( | |
name="Baby's name", | |
birthday="01.01.2020" | |
) | |
newborn.greeting() | |
newborn.introduce() | |
# Hello World! | |
# My name is [full name]. I was born on 01.01.2020. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment