Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at
"""01 - Define a class in Python."""
class Person:
"""A person has a name and likes to do things."""
def __init__(self, name: str): = name
def __str__(self) -> str:
return f"{}"
def go_to_the_movies(self) -> None:
print(f"{self} goes to the movies. 🍿")
def go_hiking(self) -> None:
print(f"{self} goes hiking. ⛰")
def build_a_robot(self) -> None:
print(f"{self} builds a robot. 🤖")
if __name__ == "__main__":
simone = Person("Simone")