1.

Write a class DISTRICT in Python with following specification: Instance Attributes– Dcode # Numeric value– DName # String value– People # Numeric value for Population– Area # Numeric value– Density # Numeric value for Population Density

Answer»

Class DISTRICT ( ) :

def_init_(self, Dcode, DName, People, Area, Density):

self.Dcode = Dcode

self.DName = DName

self.People = People

self. Area = Area

self.Density = Density

Def display (self):

print (“District Code”, self.Dcode)

printf (“District Name”, self.Dname)

printf (“Population”, self.people)

printf (“Area”, self.Area)

printf (“Density”, self.Denstity)



Discussion

No Comment Found