Python class variables 🚗

preview_player
Показать описание
Python class variables vs instance variables tutorial example explained

#python #class #variables

#---------------------------------------------------------------------
from car import Car

car_1 = Car("Chevy","Corvette",2021,"blue")
car_2 = Car("Ford","Mustang",2022,"red")

#---------------------------------------------------------------------
class Car:

wheels = 4 #class variable

def __init__(self,make,model,year,color):
#---------------------------------------------------------------------

Bro Code merch store 👟 :
===========================================================
===========================================================
Рекомендации по теме
Комментарии
Автор

Don't forget to SMASH that LIKE button and
DROP a random COMMENT down below for the YT algorithm
🙏

also here's the code from the video...

from car import Car

car_1 = Car("Chevy", "Corvette", 2021, "blue")
car_2 = Car("Ford", "Mustang", 2022, "red")

#Car.wheels = 2

print(car_1.wheels)
print(car_2.wheels)

class Car:

wheels = 4 #class variable

def __init__(self, make, model, year, color):
self.make = make #instance variable
self.model = model #instance variable
self.year = year #instance variable
self.color = color #instance variable

BroCodez
Автор

That must be the most informative video I've seen in my life, I didn't even finish my cigarette but it did feel like I just went through a whole book cover to cover

matheushemerly
Автор

Thanks Bro, your videos are short but so helpful if you want to learn something! Surely, one of the best programming channels on YouTube!

fabian
Автор

Object oriented programming was so hard for me until I watched these tutorials. I might just start learning Java! Thanks Bro.

hiiexisthiiexist
Автор

2 years ago i watched these python videos, i haven't worked with python in a while so here I'm watching these helpful and straightforward content

Madani_art
Автор

Literally teaching me more/better than my textbooks :) Thank you so much for these videos!!!

SyedNaqvi-ur
Автор

Man, this video was so helpful! Less than 2 minutes you explained exactly what I want, and I spent few hours searching in Google trying to understand this.
Thanks a lot!! 🙏

danilodelucio
Автор

Classes and their uses are very well explained. Thank you very much.

anurasenarathna
Автор

Best Java teacher on Youtube hands down

jalillateef
Автор

This is insanely well explained and so simple. Just incredible!!!

simonaugustocarroz
Автор

this video was great, as always! Tnx Bro

tara
Автор

Bro You are the Best Youtuber Love U from Pakistan😍🤩😘

hashimaleemkaka
Автор

love the format these vids bro, , "Organic Chem tutor of python"

imanhosseini
Автор

i liked and subscribed lol 4 minute video is way more clear than the other 10-15 minute videos on here..

joecookieee
Автор

Great videos!
Got a question - can instance variables be updated after creating the instance?
can we do: car_1.make = "Chevy" ?

davidhirschhorn