LimioLearn in Flow
🏆 Đấu trường
Đăng nhậpĐăng ký
← Programming for Data Science

Bạn đang xem thử công khai

Đăng nhập để lưu tiến độ, làm bài tập, thảo luận và nhận phản hồi.

Đăng nhập
Module 1: Fundamentals of Python Programming

1.10 Classes and Objects

In / Lưu PDF

1.10 Classes and Objects

After this unit you will: be able to write a simple class and create multiple objects from it.

Key points

  • A class is a blueprint; an object (instance) is a concrete entity created from the class.
  • __init__ is the constructor; self is the object that is calling the method.
  • An instance attribute (self.name) belongs to each individual object; a class attribute (Student.university) is shared by all objects.
  • Python interprets anna.status() as Student.status(anna).