DEV Community

loading...
Cover image for Ms. Class Python I (...)

Ms. Class Python I (...)

Natália Catunda
・1 min read

Now we talk about the second part of this universe.
let's go!
At first post, I put one attribute outside a method,'Kind'.
it's important if you want to work on one kind of class, right? (what you think?)
Today I create a Class Person...

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

n = Person("Natália Catunda","27 anos")
p = Person("Paulo Andrande","28 anos")
print(p.name, p.age)
Enter fullscreen mode Exit fullscreen mode

This method doesn't have any attributes outside.
just one important characteristic that code is...
the way that I declare these 2 attributes (name and age).
It's a simple representation of class very important and good to beginners like me! ;)
Thanks for reading this little python pill,
and keep learning!

Discussion (0)