from __future__ import annotations
from dataclasses import dataclass
@dataclass
class User:
name: str
name_in_lowercase: str
name_in_uppercase: str
age: int
@classmethod
def create(cls,
name: str,
age: int
) -> User:
return User(name=name,
name_in_lowercase=name.lower(),
name_in_uppercase=name.upper(),
age=age)
def print_description(self):
print(f'name: {self.name}\nname_in_lowercase: {self.name_in_lowercase}\nname_in_uppercase: {self.name_in_uppercase}\nage: {self.age}')
def main():
user = User.create(name="John Titor", age=36)
user.print_description()
if __name__ == "__main__":
main()