Python class variables 🚗

Published: 28 December 2020
on channel: Bro Code
45,813
1.9k

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")

#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
#---------------------------------------------------------------------

Bro Code merch store 👟 :
===========================================================
https://teespring.com/stores/bro-code-5
===========================================================


Watch video Python class variables 🚗 online, duration hours minute second in high quality that is uploaded to the channel Bro Code 28 December 2020. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 45,813 times and liked it 1.9 thousand visitors.