Introduction to Object-Oriented Programming in Python

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/20

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

21 Terms

1
New cards

Object-Oriented Programming (OOP)

A method of structuring a program by bundling related properties and behaviors into individual objects.

<p>A method of structuring a program by bundling related properties and behaviors into individual objects.</p>
2
New cards

Class

A blueprint for creating objects.

<p>A blueprint for creating objects.</p>
3
New cards

Instance

An object that belongs to a class.

<p>An object that belongs to a class.</p>
4
New cards

__init__() Method

Executed when a class is initiated; used to assign values to the properties of an object or perform other operations needed in the creation of an object.

5
New cards

self Parameter

A reference to the current instance of the class, used to access the variables that belong to the class.

6
New cards

Modify Object Properties

Changing the value of an object's property.

<p>Changing the value of an object's property.</p>
7
New cards

Delete Object Properties

Removing an object's property using the del keyword.

<p>Removing an object's property using the del keyword.</p>
8
New cards

Methods

Functions that belong to the object.

9
New cards

Function

Doesn't need any object and is independent.

10
New cards

Method vs Function

A method is called by the object's name, while a function can be directly called by its name.

11
New cards

Creating Objects

The process of instantiating a class to create an object.

12
New cards

Deleting Objects

The process of removing an object from memory.

13
New cards

Object Properties

Attributes associated with an object, such as name, age, and address.

14
New cards

Object Behaviors

Operations that an object can perform, such as walking, talking, and sending emails.

15
New cards

Syntax for Deleting Property

del .

16
New cards

Example of an Object

An object could represent a person with properties like a name, age, and address.

<p>An object could represent a person with properties like a name, age, and address.</p>
17
New cards

Example of an Email Object

An email object could have properties like a recipient list, subject, and body.

18
New cards

Accessing Class Variables

Using the self parameter to bind attributes with the given arguments.

19
New cards

Functionality of Methods

Methods operate on the data in a class.

20
New cards

First Parameter of Class Functions

The first parameter of any function in the class is self, but any other name can be used.

21
New cards

Real-World Modeling

OOP models real-world entities as software objects that have data and can perform operations.