In this we are going to see a basic example of python inner class - computer specification in Python Programming Language.
class Computer():
def __init__(self):
self.name = "Gigabyte Computer"
self.os = self.OS()
self.cpu = self.CPU()
class CPU():
def make(self):
return "AMD"
def model(self):
return "Ryzen 5"
class OS():
def system(self):
return "Windows 11"
my_comp = Computer()
my_os = my_comp.os
my_cpu = my_comp.cpu
print(my_comp.name)
print(my_os.system())
print(my_cpu.make())
print(my_cpu.model())
# Coded By Dhiraj Shelke
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP