Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Learn Python Object Oriented Programming! ๐Ÿš—
Play lesson

Python tutorial for beginners ๐Ÿ - Learn Python Object Oriented Programming! ๐Ÿš—

4.0 (0)
8 learners

What you'll learn

This course includes

  • 14.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

#python #pythonprogramming #pythontutorial 00:00:00 introduction 00:01:53 classes 00:02:19 constructors 00:04:13 instantiate objects 00:05:06 attribute access operator 00:06:09 multiple objects 00:07:19 modules 00:08:21 methods 00:11:52 conclusion # object = A "bundle" of related attributes (variables) and methods (functions) # Ex. phone, cup, book # You need a "class" to create many objects # class = (blueprint) used to design the structure and layout of an object # --------------- car.py --------------- class Car: def __init__(self, model, year, color, for_sale): self.model = model self.year = year self.color = color self.for_sale = for_sale def drive(self): # print("You drive the car") # print(f"You drive the {self.model}") print(f"You drive the {self.color} {self.model}") def stop(self): # print("You stop the car") # print(f"You stop the {self.model}") print(f"You stop the {self.color} {self.model}") def describe(self): print(f"{self.year} {self.color} {self.model}") # -------------------------------------- # --------------- main.py --------------- from car import Car car1 = Car("Mustang", 2024, "red", False) car2 = Car("Corvette", 2025, "blue", True) car3 = Car("Charger", 2026, "yellow", True) print(car1.model) print(car1.year) print(car1.color) print(car1.for_sale) car1.drive() car1.stop() car3.describe() # --------------------------------------

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere