class ElectronicDevice: Current = 220 class PocketGadget(ElectronicDevice): Wireless = 30 def Wireless(self): return f"it has wireless in {self.Wireless}." class Phone(PocketGadget): wireless_communication = 100 def Wireless(self): return f"it has wireless in {self.wireless_communication}." oven = ElectronicDevice() remote = PocketGadget() Samsung = Phone() print(Samsung.Wireless()) from Pakistan.... here are many followers and students of harry brother keep it up
class Elec_device: Gps = 1 Cpu =2 class Pocket_Gadget(Elec_device): Core = ["Media Tek","Snapdragon"] class Phone(Pocket_Gadget): Sensor = 5 apple = Phone() Ipod = Phone() print(apple.Sensor)
Thankyou harry bhai for uploading such type of content helping PEOPLE in YT to learn python AND IAM WATCHING THIS SERIES FROM 1st video AND NOW IAM IN 62 video 😊😊
5:45 # This my solution of this exercise # Create three classes ElectronicDevice,PocketGaget,Phone class ElectronicDevice: def __init__(self, name, price): self.name = name self.price = price def display(self): print("Electronic Information") print(f"The Name is: {self.name}") print(f"The Price is: {self.price}") print() class PocketGadgets(ElectronicDevice): def __init__(self,name,price,code,use): self.name=name self.price=price self.code = code self.use = use def display(self): print("Pocket Gadget Information") print(f"The Name is: {self.name}") print(f"The Price is: {self.price}") print(f"The Gadget code is: {self.code}") print(f"The Use of this gadget is: {self.use}") print() class Phone(PocketGadgets): def __init__(self,name,price,code,ram,rom,no_of_camera,display_size,no_of_pixel): self.name = name self.price = price self.code = code self.ram=ram self.rom=rom self.no_of_camera=no_of_camera self.display_size=display_size self.no_of_pixel=no_of_pixel def display(self): print(f"Phone Information") print(f"The Name is: {self.name}") print(f"The Price is: {self.price}") print(f"The IMEI Number is: {self.code}") print(f"The Ram size is: {self.ram}") print(f"The Storage size is: {self.rom}") print(f"This Phone have {self.no_of_camera} number of camera's") print(f"The Display size is: {self.display_size} Inches") print(f"The Main Camera have: {self.no_of_pixel} pixels") print() battery=ElectronicDevice("Battery",100) battery.display() earPhoneWoBhiBluetoothWala=PocketGadgets("Boat 138",899,"B34X37","To listen Music and Attend Online classes") earPhoneWoBhiBluetoothWala.display() redmiNote_8=Phone("Redmi Note 8",10999,384876767836,"4GB","64GB",4,6.5,"48MP") redmiNote_8.display()
harry bhai you are genius 😍 This is your Exercise answer class Electronic_devices: Mobile=10 pc=10 speekers=15 keybord=9 def electroin(self): return f"Mobiles in stock {self.Mobile} PC in Stock {self.pc} speekers in stock {self.speekers} Keyborad in stock {self.keybord}" class pokets_gadgets(Electronic_devices): power_bank=15 earphones=16 Blutooth_earphones=15 earbuds=17 def pocket(self): return f"Power Bank in stock {self.power_bank} Earphones in stock {self.earphones} Blutooth in stock {self.Blutooth_earphones} Earbuds in stock {self.earbuds}" class mobile(pokets_gadgets): Vivo= 15 oppo= 17 MI= 10 Apple= 5 def mobile(self): return f"2GB Ram VIVO mobiles in stock {self.Vivo} 3GB Ram OPPO mobiles in stock{self.oppo} 4GB Ram MI mobiles in stock {self.MI} 6GB Ram APPLE mobiles in stock {self.MI}" SS_electronic=Electronic_devices() SS_Gadgets=pokets_gadgets() SS_mobile=mobile() print(SS_mobile.mobile()," ") print(SS_Gadgets.pocket()," ") print(SS_electronic.electroin())
4:45 is will return 1 as larry inherites from darry so larry has all the methods of darry and harry inherites from larry so harry has all the methods from larry which means indirectly he get darry's methods
class electronic_device(): power_consumption=("100w") class pocket_gadget(electronic_device): power_consumption=("50w") class phone(pocket_gadget): power_consumption=("5-6w") def mobile(self): return(f"This uses a rechargable battery which is of {self.name}") battery=phone() battery.name="2500 mAh" print(phone.mobile(battery)) print(phone.power_consumption)
class ElectronicDevice(): display = 1 speaker = "At the Back only one" mobility = False priceRange = "High" size = "very Large" class PocketGadget(ElectronicDevice): size = "Small Comparatively" communication = "better Communication" class Phone(PocketGadget): size = "Very Small " mobility = True speaker = "At the Back and Front,very small and SDM components" old = ElectronicDevice() middle = PocketGadget() newGen = Phone() print(newGen.size) print(newGen.communication)
class phone(PocketGagates): wire="copper" vooranti="4 years" TV=ElectronicDivice("TV",6*10**4) anywheredoor=PocketGagates("Any where door",10**6+5*4+3**7) iphone=phone("iPHONE",10**4*6+6000,"MAC")
Harry sir this is code of task... class ElectronicDevice: devices = ['Phone','Laptop','Calculator', ' Pad'] class PocketGadget(ElectronicDevice): devices = ['Laptop','Phone'] def contains(self): return f"PocketGadget can conatains {self.devices}" class Phone(PocketGadget): apps = ['PUG','Google'] def contains(self): return f"The phone contains apps as {self.apps} and lots of features for use" kalu = ElectronicDevice() Bhalu = PocketGadget() shalu = Phone() print(shalu.contains()) print(Bhalu.contains())
class ElectronicDevices: system = "binary" class PocketGadgets(ElectronicDevices): size = "Mostly smaller than 7 inches" class Phones(PocketGadgets): no_of_phones = "1000000000" pass print(Phones.size) print(Phones.no_of_phones) print(Phones.system)
@CodeWithHarry Hello Harry bhai, Bhaiya aapka python ka course bahut mazedar and helpful hein.Agar OOP me aur exercises hoti to aur maja aa jata kyun ki woh part only theory jesa feel ho rha h.
print (harry.basketball) --> 1 # this is because it'll first find in Grandson class, then in Son class, then in Dad class # since there is no variable of class in Son and Grandson, it prints the value of basketball variable defined in # the Dad class
Quiz is: class electronic_device: no_of_circuits = 120 class pocket_gadgets(electronic_device): no_of_circuits = 130,000 calculation = 24 battery = 0 def call(self): return f"I can do {self.calculation} in 1 seconds." class phone(pocket_gadgets): call = 190 calculation = 1202093093 no_of_circuits = "120 billion" def call(self): print(f"I can do {self.call} in a day.") print(phone.battery)
class Electricty: print("Uses of Electricty") power_voltage = 15 precaution = "Be careful with me!" print(precaution) class Gadgets(Electricty): print("Uses of Gadgets") precaution1 = "Be a little hard working in doing your work by your own. Do not use me much" print(precaution1) class Phone(Gadgets): print("Uses of Phone") precaution2 = "Be a limited time with me!" print(Phone.precaution) print(Phone.precaution1) print(Phone.precaution2)
Watching this on 25 December 2021, exact after 3 years 😂 class electronic: charge = 'unlimited' portable = False class pocket(electronic): charge = 100 portable = True class mobile(pocket): addictive = True generator = electronic() pocket_device = pocket() phone = mobile() print(phone.charge) ------------------- I don't know if this make sense or not
class Electronic_Device(): no_of_uses="One or two only" Advantages=["It makes us easier to do our job"] Disadvantages=["More consumption of electricity","Very big size and Can't take it anywhere","Very high cost"] def __init__(self,name,use,price): self.name=name self.use=use self.price=price def printdetails(self): return f"Name of device is {self.name} , its use is {self.use} and price is {self.price}" class Pocket_Gadgets(Electronic_Device): no_of_uses ="Few only" type=["Watches,Phones,Pen drive"] Advantages=["It makes us easier to do our job","Least consumption of electricity","Small size and can be taken anywhere","Very low cost"] Disadvatages=["People get lazy by using it"] def __init__(self,name,use,price): self.name = name self.use = use self.price = price def printdetails(self): return f"Name of device is {self.name} , its use is {self.use} and price is {self.price}" class Phones(Pocket_Gadgets): no_of_uses = "Many uses" type=["Keypad phones","Smart phones","Smart watches"] Advantages = ["Various utilities","Entertainment","Small size and can be taken anywhere","fair cost"] Disadvatages = ["Constantly distracting","Sleep deprivation","Health problems","People get lazy by using it"] def __init__(self,name,functions,price,company): self.name = name self.functions = functions self.price = price self.company = company def printdetails(self): return f"Name of device is {self.name} , its use is {self.functions} , price is {self.price} and name of companies is {self.company}" Washing_machine=Electronic_Device("Washing machine","For cleaning clothes","8000 to 25000") Refrigerator=Electronic_Device("Refrigerator","For keeping food products cool and fresh","10000 to 50000") watch=Pocket_Gadgets("watch","For seeing time","100 to 10000") pen_drive=Pocket_Gadgets("Pen drive","For storing and transferring data","150 to 5000") keypad_phone=Phones("Keypad phone",["Calling","Texting","Listening music"],"1000 to 4000",["Samsung","Karbonn","Nokia","Jio phone","Blackberry"]) smart_phone=Phones("SmartPhone",["Calling","Texting","Seeing Videos","Listening music","Playing games","Booking tickets"],"5000 to 100000",["Samsung","Motorola","Nokia","Oneplus","Asus","Redmi","Apple"]) print(Washing_machine.printdetails()) print(pen_drive.printdetails()) print(smart_phone.printdetails())
Answer of the quiz is 1, because the grandson class is linked to son class and then son class is linked to dad class where we fine variable of basketball thats why it will print 1
#OOPS EXCERCISE class Electronics_Devices: Types_of_Electronics=5 def isElectronic(self): return f"Yes its in {self.Types_of_Electronics} types of electronics " class Pocket_gaget(Electronics_Devices): No_of_gagets=10 def isPocketgaget(self): return f"Yes I can make {self.No_of_gagets} no.of gagets" class Phone(Pocket_gaget): No_of_phones=4 def Howmanyphones(self): return f"I have {self.No_of_phones} no.of phones" ohm_digital_store=Electronics_Devices() amazon=Pocket_gaget() puranjan_dream_house=Phone() print(puranjan_dream_house.No_of_phones)
harry bhai answer 1 aaye ga kyonki harry Grandson class ka which has access to Son class and which has access to Dad class, so indirectly Grandson has access to dad class and so wo uske artributes and methods le sakta hai. ThankYou
class electronic_device: use = 50 disadvantages = 90 class pocket_gadget: use = 90 class phone(electronic_device,pocket_gadget): use = 100 redmi = phone() print(redmi.disadvantages)
class Electronic_device: def __init__(self,name,model): self.name=name self.model=model class Pocket_gadget(Electronic_device): def printdetails(self): return f" the device name is {self.name} and model number is {self.model}" class Phone(Pocket_gadget): pass iphone=Phone("iphone12",5456) print(iphone.printdetails())
class Electronic_devices: battery="5000mah" class Pocket_gadgets(Electronic_devices): size="6inches" class Mobile_phones(Pocket_gadgets): Ram="8gb" ED=Electronic_devices() PG=Pocket_gadgets() MP=Mobile_phones() print(MP.size) print(MP.battery) print(MP.Ram)
class Electronic_Devices: def Laptop(self,str1): print(f"{str1} is a company of Electronic devices and laptop is its main Example") class Pocket_Gadgets(Electronic_Devices): def Tablet(self,str1): print(f" But {str1} doesn't make Tablets") class Phone(Pocket_Gadgets): def Phone(self,str2): print(f"And {str2} makes phone") Obj = Phone() Obj.Laptop("HP") Obj.Tablet("HP") Obj.Phone("Redmi")
class Electronics: voltage="2kw" def isvolt(self): return f"THis Device takes {self.voltage} to run the circuit" class PocketGadgets(Electronics): voltage="0.5kw" def isvolt(self): return f"This Gadget takes {self.voltage} to run the circuit." \ f" so that it works fine" class Phone(PocketGadgets): voltage = "100w" def isvolt(self): return f"This Phone takes {self.voltage} to run the circuit" \ f" So that Phone turns on and works perfrctly" motor = Electronics() torch= PocketGadgets() mobile= Phone() print(mobile.isvolt())
class Electroic: def poweruse(self): print (f"My name is {self.name}, I use electricity to work") class Pocketgadget(Electroic): def fitinpocket(self): self.poweruse() print ( f"{self.name} fits in your pocket easily ") class Phone(Pocketgadget): def __init__(self, name): self.name = name Nokia3315 =Phone("Nokia-3315") Nokia3315.fitinpocket()
class Eledevice: electronicdevice= "Cell Tower" class Pokdevice(Eledevice): Pokect_device = "sim card"
class phone(Pokdevice): def call_possible_in_mobile(self): return f"Call is possible when {self.electronicdevice} transmit the signal and {self.Pokect_device} receive the signal. " ram = Eledevice() shyam = Pokdevice() jhyam = phone() print(jhyam.call_possible_in_mobile())
Merry Christmas guyz!
Kis kis ko Santa Claus ne gift diya? Muje to ek T-Shirt mili mere secret santa se! :) :)
muje tho Gaming mouse mila :) :) ;)
Bhai aap kaha rehto aur kaunsi company me job karte ho jaha aapko secret santa me gift mili tshirt?
mujhe python sikhne ka mauka mila mere secret santa se 😊😊
@@ad_uke areee waah..
@@ad_uke 🤣🤣 naaaice 👌👌😂
aap mere secret santa ho aapne mujhe ye pura course diya. ThankYou Sir. Ap Best Teacher Ho
class ElectronicDevice:
Current = 220
class PocketGadget(ElectronicDevice):
Wireless = 30
def Wireless(self):
return f"it has wireless in {self.Wireless}."
class Phone(PocketGadget):
wireless_communication = 100
def Wireless(self):
return f"it has wireless in {self.wireless_communication}."
oven = ElectronicDevice()
remote = PocketGadget()
Samsung = Phone()
print(Samsung.Wireless())
from Pakistan....
here are many followers and students of harry brother keep it up
you are seriously amazing.. your coding skills and way of explanation are mind blowing
thank you harry bhai for so many videos. This is my exercise
class electronic_device:
devices = 4
def ectro(self):
return f"no of electronic device is {self.devices}"
class phone(electronic_device):
phone = "redmi note 8 pro"
def no_of_phone(self):
return f"no of phone is {self.phone}"
class pocketdevice(phone):
pocket_device = ["charger", "laptop adapter", "bluethhooth speaker"]
def pocdev(self):
return f"no of pocket device are {self.pocket_device}"
devices = electronic_device()
apple = phone()
charger = pocketdevice()
print(charger.phone)
thankyou
class Elec_device:
Gps = 1
Cpu =2
class Pocket_Gadget(Elec_device):
Core = ["Media Tek","Snapdragon"]
class Phone(Pocket_Gadget):
Sensor = 5
apple = Phone()
Ipod = Phone()
print(apple.Sensor)
class electronicdevices:
motherboard = 1
circuit = 5
class pocketgadget(electronicdevices):
GPS = 1
circuit = 8
time = "yes"
class Smartphone(pocketgadget):
screentouch = 1
circuit = 9
GPU = 1
CPU = 1
TV = electronicdevices()
ipod = pocketgadget()
apple = Smartphone()
print(apple.circuit)
print(apple.motherboard)
Output :9,1
Nice
Great ! But start Class name with caps :)
this is video is amazing and my programming level is very fast
thankyu harry bahi
thank for everything
Thankyou harry bhai for uploading such type of content helping PEOPLE in YT to learn python
AND IAM WATCHING THIS SERIES FROM 1st video AND NOW IAM IN 62 video 😊😊
Me too I am st 11th i am happy I am going to complete python before 12
@@PacifistJACK complete ho gaya?
class electronic_device():
speaker = 2
microphone = 1
keyboard = 1
processor = 1
class pocket_device(electronic_device):
carry = "easy"
class phone(pocket_device):
camera = 4
speaker = 1
computer = electronic_device()
iphone_14 = phone()
print(iphone_14.camera)
print(iphone_14.processor)
4:45 it will print 1
4:43 Answer is 1 cause Grandson inherits Son which inherits Dad. Thus, Grandson, indirectly, inherits Dad.
Here is code :-
class electro:
model = 'Fridge'
Weight = '150kg'
Rating = "🌟🌟🌟🌟🌟"
price = "₹30000"
color = 'red'
class pocketGadget(electro):
model = 'earphone'
price = "₹500"
Rating = '🌟🌟🌟'
Weight = "50g"
class phone(pocketGadget):
model = 'Apple'
price = "₹150000"
Rating = "🌟🌟🌟🌟🌟🌟🌟"
Security = "🌟🌟🌟🌟🌟🌟🌟..."
Weight = "500g"
a = electro()
b = pocketGadget()
c = phone()
print(b.Rating)
print(c.Rating)
print(c.color)
print(b.color)
print(phone.mro())
You are unstoppable harry. Thanku so much for awesome tutorial
Thanks harry.
Their can't be any best example of inheritance that Dad, Son and grandSon.
class Edevice():
circuit = 1
class Pgadget(Edevice):
keep_in_pocket = 1
class Phone(Pgadget):
call = 1
print(Pgadget.circuit)
Pgadget se circuit ko call keia..ye hi to he.
5:45
# This my solution of this exercise
# Create three classes ElectronicDevice,PocketGaget,Phone
class ElectronicDevice:
def __init__(self, name, price):
self.name = name
self.price = price
def display(self):
print("Electronic Information")
print(f"The Name is: {self.name}")
print(f"The Price is: {self.price}")
print()
class PocketGadgets(ElectronicDevice):
def __init__(self,name,price,code,use):
self.name=name
self.price=price
self.code = code
self.use = use
def display(self):
print("Pocket Gadget Information")
print(f"The Name is: {self.name}")
print(f"The Price is: {self.price}")
print(f"The Gadget code is: {self.code}")
print(f"The Use of this gadget is: {self.use}")
print()
class Phone(PocketGadgets):
def __init__(self,name,price,code,ram,rom,no_of_camera,display_size,no_of_pixel):
self.name = name
self.price = price
self.code = code
self.ram=ram
self.rom=rom
self.no_of_camera=no_of_camera
self.display_size=display_size
self.no_of_pixel=no_of_pixel
def display(self):
print(f"Phone Information")
print(f"The Name is: {self.name}")
print(f"The Price is: {self.price}")
print(f"The IMEI Number is: {self.code}")
print(f"The Ram size is: {self.ram}")
print(f"The Storage size is: {self.rom}")
print(f"This Phone have {self.no_of_camera} number of camera's")
print(f"The Display size is: {self.display_size} Inches")
print(f"The Main Camera have: {self.no_of_pixel} pixels")
print()
battery=ElectronicDevice("Battery",100)
battery.display()
earPhoneWoBhiBluetoothWala=PocketGadgets("Boat 138",899,"B34X37","To listen Music and Attend Online classes")
earPhoneWoBhiBluetoothWala.display()
redmiNote_8=Phone("Redmi Note 8",10999,384876767836,"4GB","64GB",4,6.5,"48MP")
redmiNote_8.display()
4:45 We will get value of basketball as 1 because we know that Grandson is inherited by Son and Son has basketball = 1 as it is inherited by Dad
4:45 1 is the output
Input :
print(harry.basketball)
Output :
1
print(harry.basketball)
output: 1
harry bhai you are genius 😍
This is your Exercise answer
class Electronic_devices:
Mobile=10
pc=10
speekers=15
keybord=9
def electroin(self):
return f"Mobiles in stock {self.Mobile}
PC in Stock {self.pc}
speekers in stock {self.speekers}
Keyborad in stock {self.keybord}"
class pokets_gadgets(Electronic_devices):
power_bank=15
earphones=16
Blutooth_earphones=15
earbuds=17
def pocket(self):
return f"Power Bank in stock {self.power_bank}
Earphones in stock {self.earphones}
Blutooth in stock {self.Blutooth_earphones}
Earbuds in stock {self.earbuds}"
class mobile(pokets_gadgets):
Vivo= 15
oppo= 17
MI= 10
Apple= 5
def mobile(self):
return f"2GB Ram VIVO mobiles in stock {self.Vivo}
3GB Ram OPPO mobiles in stock{self.oppo}
4GB Ram MI mobiles in stock {self.MI}
6GB Ram APPLE mobiles in stock {self.MI}"
SS_electronic=Electronic_devices()
SS_Gadgets=pokets_gadgets()
SS_mobile=mobile()
print(SS_mobile.mobile(),"
")
print(SS_Gadgets.pocket(),"
")
print(SS_electronic.electroin())
What a coincidence I am watching it on 26th December, exactly one year later.
Lol
And I am watching post 2 years.😂😂
I aam also watching 2 years later
4:49 :: Quiz = It will print 1.
4:45 is will return 1 as larry inherites from darry so larry has all the methods of darry and harry inherites from larry so harry has all the methods from larry which means indirectly he get darry's methods
4:45
Output will be 1
no 1 dude , i wish if you continue ml using python , and detailed video about data munging , normalization and eda .
class electronic_device():
power_consumption=("100w")
class pocket_gadget(electronic_device):
power_consumption=("50w")
class phone(pocket_gadget):
power_consumption=("5-6w")
def mobile(self):
return(f"This uses a rechargable battery which is of {self.name}")
battery=phone()
battery.name="2500 mAh"
print(phone.mobile(battery))
print(phone.power_consumption)
04:23
The output is 1
You are great mentor 🔥💓
class Electronice_device:
Laptop = 5
Camera = 7
class Pocket_gadget(Electronice_device):
Toolbox = 1
leaser = 2
def repair_kit(self):
return f"Best pocket gadget {self.leaser} for emergency"
class Phone(Pocket_gadget):
samsung = 3
iphone = 10
rakshit = Electronice_device()
devender = Pocket_gadget()
ravi = Phone
print(rakshit.Laptop)
class ElectronicDevice():
display = 1
speaker = "At the Back only one"
mobility = False
priceRange = "High"
size = "very Large"
class PocketGadget(ElectronicDevice):
size = "Small Comparatively"
communication = "better Communication"
class Phone(PocketGadget):
size = "Very Small "
mobility = True
speaker = "At the Back and Front,very small and SDM components"
old = ElectronicDevice()
middle = PocketGadget()
newGen = Phone()
print(newGen.size)
print(newGen.communication)
The example you used for this topic is very good.
class electronic_device:
radio = 1
TV = 1
speaker = 1
landline = 2
class pocket_gadget(electronic_device):
music_player = 1
compass = 1
class phone(pocket_gadget):
sphone = 1
print(phone.radio)
multilevel inheritance could be explained by venn diagram
gole ke andar gola ke andar gola
Quiz answer :
4:34 harry bhai 1 he aaega
7:41
class ElectronicDivice:
company="Google"
Cover="Plastic"
Wire="Copper"
MotherBoard=1
No_of_fuse=5
vooranti="3 years"
def __init__(self,divice_name,price,*os):
self.divice=divice_name
self.company=ElectronicDivice.company
self.price=price
self.os=os
class PocketGagates(ElectronicDivice):
wire="Gold"
vooranti="5 years"
class phone(PocketGagates):
wire="copper"
vooranti="4 years"
TV=ElectronicDivice("TV",6*10**4)
anywheredoor=PocketGagates("Any where door",10**6+5*4+3**7)
iphone=phone("iPHONE",10**4*6+6000,"MAC")
God Bless You!
4:42 Quiz: Answer is 1
lass abhi:
football =6
class anu(abhi):
dance = 2
def isdance(self):
return f"yes I can dance {self.dance} no of times"
class aaa(anu):
dream = "com"
harry = abhi()
larry = anu()
carry = aaa()
print(larry.isdance())
print(carry.isdance())
print(carry.football)
Timestamp 4:46 1 hi aayega , because sabse pehle control usi class mai check karega and agar nahi mila to parent class mai .
Thank you harry bhai
Harry sir this is code of task...
class ElectronicDevice:
devices = ['Phone','Laptop','Calculator', ' Pad']
class PocketGadget(ElectronicDevice):
devices = ['Laptop','Phone']
def contains(self):
return f"PocketGadget can conatains {self.devices}"
class Phone(PocketGadget):
apps = ['PUG','Google']
def contains(self):
return f"The phone contains apps as {self.apps} and lots of features for use"
kalu = ElectronicDevice()
Bhalu = PocketGadget()
shalu = Phone()
print(shalu.contains())
print(Bhalu.contains())
class ElectronicDevices:
system = "binary"
class PocketGadgets(ElectronicDevices):
size = "Mostly smaller than 7 inches"
class Phones(PocketGadgets):
no_of_phones = "1000000000"
pass
print(Phones.size)
print(Phones.no_of_phones)
print(Phones.system)
@CodeWithHarry Hello Harry bhai,
Bhaiya aapka python ka course bahut mazedar and helpful hein.Agar OOP me aur exercises hoti to aur maja aa jata kyun ki woh part only theory jesa feel ho rha h.
Harry.basketball should be 1 ..
Love you harry bhai..
you are simply amazing and thank u harry bhai..
harry bhai hackers ko konsi programming sikhni chayie aapke hisaab se
ek complete video bnayi ye
enjoying the playlist
print (harry.basketball)
--> 1
# this is because it'll first find in Grandson class, then in Son class, then in Dad class
# since there is no variable of class in Son and Grandson, it prints the value of basketball variable defined in # the Dad class
4:24
Ans = 1
class Electronic_device:
motherboard = 1
gpu = 7
cpu = 8
ram = 32
class Pocket_gadget(Electronic_device):
powerbank = 1
charger = 2
sim = 7
class Phone(Pocket_gadget):
phone = 1
oneplus = Phone()
print(oneplus.gpu)
print(oneplus.powerbank)
print(oneplus.phone)
Quiz is:
class electronic_device:
no_of_circuits = 120
class pocket_gadgets(electronic_device):
no_of_circuits = 130,000
calculation = 24
battery = 0
def call(self):
return f"I can do {self.calculation} in 1 seconds."
class phone(pocket_gadgets):
call = 190
calculation = 1202093093
no_of_circuits = "120 billion"
def call(self):
print(f"I can do {self.call} in a day.")
print(phone.battery)
class Electronicdevice:
buttons=3
class Pocketdevice(Electronicdevice):
screen=1
class Phone(Pocketdevice):
calls=12
def call(self):
return f"You can call {self.calls} times"
ed=Electronicdevice()
pd=Pocketdevice()
P=Phone()
print(P.call())
class edevice:
electronick_device = 4
class pgajate(edevice):
keep_in_pocket = 2
class phone(pgajate):
can_call_any_one = 1
ajay = phone
print(ajay.keep_in_pocket)
class ElectronicDevice:
MotherBoard = 1
Sensor = 1
class PocketGadget(ElectronicDevice):
GPS = 1
Sensor = 2
class Mobile(PocketGadget):
GPU = 1
GPS = 2
ScreenTouch = 1
TV = ElectronicDevice
IPAD = PocketGadget
MI = Mobile
print(MI.Sensor)
i used to watched this video of harry bhai... trying to understand
class Electricty:
print("Uses of Electricty")
power_voltage = 15
precaution = "Be careful with me!"
print(precaution)
class Gadgets(Electricty):
print("Uses of Gadgets")
precaution1 = "Be a little hard working in doing your work by your own. Do not use me much"
print(precaution1)
class Phone(Gadgets):
print("Uses of Phone")
precaution2 = "Be a limited time with me!"
print(Phone.precaution)
print(Phone.precaution1)
print(Phone.precaution2)
it will print 1 , because all the methods of parent class are in child class so it automatically goes to the parent class
answer is 1 because the inheritance the variable is carried out by the son since grandson is inheriting then the variable is accessble to the grandson
Watching this on 25 December 2021, exact after 3 years 😂
class electronic:
charge = 'unlimited'
portable = False
class pocket(electronic):
charge = 100
portable = True
class mobile(pocket):
addictive = True
generator = electronic()
pocket_device = pocket()
phone = mobile()
print(phone.charge)
-------------------
I don't know if this make sense or not
Print(Harry.basketball). Output:-1
class Electronic_Device():
no_of_uses="One or two only"
Advantages=["It makes us easier to do our job"]
Disadvantages=["More consumption of electricity","Very big size and Can't take it anywhere","Very high cost"]
def __init__(self,name,use,price):
self.name=name
self.use=use
self.price=price
def printdetails(self):
return f"Name of device is {self.name} , its use is {self.use} and price is {self.price}"
class Pocket_Gadgets(Electronic_Device):
no_of_uses ="Few only"
type=["Watches,Phones,Pen drive"]
Advantages=["It makes us easier to do our job","Least consumption of electricity","Small size and can be taken anywhere","Very low cost"]
Disadvatages=["People get lazy by using it"]
def __init__(self,name,use,price):
self.name = name
self.use = use
self.price = price
def printdetails(self):
return f"Name of device is {self.name} , its use is {self.use} and price is {self.price}"
class Phones(Pocket_Gadgets):
no_of_uses = "Many uses"
type=["Keypad phones","Smart phones","Smart watches"]
Advantages = ["Various utilities","Entertainment","Small size and can be taken anywhere","fair cost"]
Disadvatages = ["Constantly distracting","Sleep deprivation","Health problems","People get lazy by using it"]
def __init__(self,name,functions,price,company):
self.name = name
self.functions = functions
self.price = price
self.company = company
def printdetails(self):
return f"Name of device is {self.name} , its use is {self.functions} , price is {self.price} and name of companies is {self.company}"
Washing_machine=Electronic_Device("Washing machine","For cleaning clothes","8000 to 25000")
Refrigerator=Electronic_Device("Refrigerator","For keeping food products cool and fresh","10000 to 50000")
watch=Pocket_Gadgets("watch","For seeing time","100 to 10000")
pen_drive=Pocket_Gadgets("Pen drive","For storing and transferring data","150 to 5000")
keypad_phone=Phones("Keypad phone",["Calling","Texting","Listening music"],"1000 to 4000",["Samsung","Karbonn","Nokia","Jio phone","Blackberry"])
smart_phone=Phones("SmartPhone",["Calling","Texting","Seeing Videos","Listening music","Playing games","Booking tickets"],"5000 to 100000",["Samsung","Motorola","Nokia","Oneplus","Asus","Redmi","Apple"])
print(Washing_machine.printdetails())
print(pen_drive.printdetails())
print(smart_phone.printdetails())
you are not using the variables like type, advantages and disadvantages(code optimistic nhi hai😅 ) though nice one!!!👍
@@omkar_shivam thank you
Thanks for these great series on python
Harry Bhai screen k colour change kro...code dikh ni rha ....white white or zoom b krna
class Electronic_Device:
embedded_circuit = 1
class Pocket_Gadget(Electronic_Device):
easily_movable = 1
class Phone(Pocket_Gadget):
communication = 1
photos = 1
gaming = 1
chargeable = 1
print(Phone.embedded_circuit)
Appke class instance Nehi hain..
Print("harry.basketball")
Output:1 by multiple inheritance
class Electronicdevice():
circuit = 1
class Pocketgadget(Electronicdevice):
keep_in_pocket = 1
class Phone(Pocketgadget):
call = 1
print(Pocketgadget.circuit)
class Electronic_device:
battery = 2
class Pocket_gadget(Electronic_device):
display = 1
class Phone(Pocket_gadget):
camera = 4
print(Phone.display)
Sir please machine learning ke videos b sath sath upload krain na.. please Sir us series ko b continue ki jiye
class electronicdevice():
compo = 20
class pocketgadget(electronicdevice):
fuses = 30
def no_of_fuses(self , fuses):
return f"No of fuse{self.fuses}"
class phone(pocketgadget):
wires = 100
screen = electronicdevice()
mic = pocketgadget()
mi = phone()
det = mi.wires
print(det)
Answer of the quiz is 1, because the grandson class is linked to son class and then son class is linked to dad class where we fine variable of basketball thats why it will print 1
Quiz answer -
class Dad:
basketball = 1
harry = Dad()
print(harry.basketball)
>>> 1
Bahot badhiya bhai
Thanks bhai!
class electronic_device:
television = 1
wires = 10
car =1
class pocket_devices(electronic_device):
pocket_fan =1
battery =2
class phone(pocket_devices):
battery =1
speaker=2
fingerprint_sensor = 1
swapnesh = phone()
harry_sir = pocket_devices()
elon_musk = electronic_device()
4:48 answer is 1
Answer would be 1 because son inherited basketball = 1 from father and father inherited it from grandfather
class electronic_device:
monitor = 6
cpu = 4
keybord = 7
class pocket_gadget(electronic_device):
smartphon = 5
tablate = 6
class phone(pocket_gadget):
smasung = 5
iphon = 7
ec = electronic_device()
pg = pocket_gadget()
ph = phone()
print(ph.iphon, "- iphon")
print(ph.tablate, "- tablate")
print(ph.cpu, "- cpu")
4:40...1 ayega bro....
#OOPS EXCERCISE
class Electronics_Devices:
Types_of_Electronics=5
def isElectronic(self):
return f"Yes its in {self.Types_of_Electronics} types of electronics "
class Pocket_gaget(Electronics_Devices):
No_of_gagets=10
def isPocketgaget(self):
return f"Yes I can make {self.No_of_gagets} no.of gagets"
class Phone(Pocket_gaget):
No_of_phones=4
def Howmanyphones(self):
return f"I have {self.No_of_phones} no.of phones"
ohm_digital_store=Electronics_Devices()
amazon=Pocket_gaget()
puranjan_dream_house=Phone()
print(puranjan_dream_house.No_of_phones)
04:51 it will give 1
harry bhai answer 1 aaye ga kyonki harry Grandson class ka which has access to Son class and which has access to Dad class, so indirectly Grandson has access to dad class and so wo uske artributes and methods le sakta hai. ThankYou
vERY nICE BHAI IT REALLY HELP
Thankyou so much Sir!❤️It really helped me!
Great harry bhai
class electronic_device:
use = 50
disadvantages = 90
class pocket_gadget:
use = 90
class phone(electronic_device,pocket_gadget):
use = 100
redmi = phone()
print(redmi.disadvantages)
class Electronic_device:
def __init__(self,name,model):
self.name=name
self.model=model
class Pocket_gadget(Electronic_device):
def printdetails(self):
return f" the device name is {self.name} and model number is {self.model}"
class Phone(Pocket_gadget):
pass
iphone=Phone("iphone12",5456)
print(iphone.printdetails())
class electronic_device :
cell=1
class pocket_gedget(electronic_device):
cell=1
keypad=1
screen=1
class phone(pocket_gedget):
cell=1
keypad=1
screen=1
motherboard=1
battery=electronic_device()
payzer=pocket_gedget()
mobile=phone()
print(mobile.cell)
print(payzer.keypad)
class Electronic_devices:
battery="5000mah"
class Pocket_gadgets(Electronic_devices):
size="6inches"
class Mobile_phones(Pocket_gadgets):
Ram="8gb"
ED=Electronic_devices()
PG=Pocket_gadgets()
MP=Mobile_phones()
print(MP.size)
print(MP.battery)
print(MP.Ram)
class Electronic_Devices:
def Laptop(self,str1):
print(f"{str1} is a company of Electronic devices and laptop is its main Example")
class Pocket_Gadgets(Electronic_Devices):
def Tablet(self,str1):
print(f" But {str1} doesn't make Tablets")
class Phone(Pocket_Gadgets):
def Phone(self,str2):
print(f"And {str2} makes phone")
Obj = Phone()
Obj.Laptop("HP")
Obj.Tablet("HP")
Obj.Phone("Redmi")
class electronic_device:
electric_consumtion = " consumes "
class pocket_gadget(electronic_device):
portability = " very portable"
class phone(pocket_gadget):
message = " Yes i can message"
lg = electronic_device()
sony = pocket_gadget()
apple = phone()
print(apple.message)
hope you seee it
love from punjab
time 4:46 answer is 1
class Electronic_device:
keypad = 104
class Pocket_gadget(Electronic_device):
touchscreen = "At few"
multitasking = "Yes"
def isworking(self):
return f"This has touchscreen {self.touchscreen} with multitasking {self.multitasking}"
class Phone(Pocket_gadget):
touchscreen = "At whole screen"
multitasking = "Yes"
Generation_4th = "LTE"
def isworking(self):
return f"This has touchscreen {self.touchscreen} with multitasking {self.multitasking} " \
f"and aslo support 4th generation {self.Generation_4th}"
laptop = Electronic_device
phones = Pocket_gadget
android = Phone
print(android.keypad)
class Electronics:
voltage="2kw"
def isvolt(self):
return f"THis Device takes {self.voltage} to run the circuit"
class PocketGadgets(Electronics):
voltage="0.5kw"
def isvolt(self):
return f"This Gadget takes {self.voltage} to run the circuit." \
f" so that it works fine"
class Phone(PocketGadgets):
voltage = "100w"
def isvolt(self):
return f"This Phone takes {self.voltage} to run the circuit" \
f" So that Phone turns on and works perfrctly"
motor = Electronics()
torch= PocketGadgets()
mobile= Phone()
print(mobile.isvolt())
class Raw_Materials:
a="silicon"
b="polymer"
c="steel"
class Electronic_Component(Raw_Materials):
d="capacitor"
a="transistor"
def log(self):
return f"the main component is: {self.d}"
class Phone(Electronic_Component):
d="vivo x21"
def log(self):
return f"the model name is {self.d}"
Tata=Raw_Materials()
Intel=Electronic_Component()
Vivo=Phone()
print(Vivo.log())
print(harry.basketball)
will print 1
quiz answer: yes it will print 1 when print(harry.basketball)
Yes sir 1 will come
class Electroic:
def poweruse(self):
print (f"My name is {self.name}, I use electricity to work")
class Pocketgadget(Electroic):
def fitinpocket(self):
self.poweruse()
print ( f"{self.name} fits in your pocket easily ")
class Phone(Pocketgadget):
def __init__(self, name):
self.name = name
Nokia3315 =Phone("Nokia-3315")
Nokia3315.fitinpocket()
class Eledevice:
electronicdevice= "Cell Tower"
class Pokdevice(Eledevice):
Pokect_device = "sim card"
class phone(Pokdevice):
def call_possible_in_mobile(self):
return f"Call is possible when {self.electronicdevice} transmit the signal and {self.Pokect_device} receive the signal. "
ram = Eledevice()
shyam = Pokdevice()
jhyam = phone()
print(jhyam.call_possible_in_mobile())