Python Objects and Classes
Python Objects and Classes
In this tutorial, you will learn about the core functionality of Python objects
and classes. You'll learn what a class is, how to create it and use it in your
program.
class MyNewClass:
'''This is a docstring. I have created a new class'''
pass
class Person:
"This is a person class"
age = 10
def greet(self):
print('Hello')
# Output: 10
print(Person.age)
Output
10
<function Person.greet at 0x7fc78c6e8160>
This is a person class