Skip to content

Latest commit

 

History

History
14 lines (11 loc) · 518 Bytes

README.md

File metadata and controls

14 lines (11 loc) · 518 Bytes

Let's create the class Person with the specified attributes and the introduce method.

class Person:
   def __init__(self, name, age, gender):
      self.name = name
      self.age = age
      self.gender = gender

def introduce(self):
    print(f"Hello, my name is {self.name}, I am {self.age} years old, and I identify as {self.gender}.")

Creating an instance of the Person class and calling the introduce method

person = Person("Alice", 25, "female")
person.introduce()