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


On this page of the site you can watch the video online Python class variables 🚗 with a duration of hours minute second in good quality, which was uploaded by the user Bro Code 28 December 2020, share the link with friends and acquaintances, this video has already been watched 45,813 times on youtube and it was liked by 1.9 thousand viewers. Enjoy your viewing!