Check the wrong of this code and show the exact code
dict1={}
class AddColumn:
def add_column(str1,list1):
dict1[str1].append(list1)
x=AddColumn()
x.add_column( "City name",["Adelaide", "Brisbane", "Darwin", "Hobart", "Sydney", "Melbourne", "Perth"])
x.add_column("Area", [1295,5905, 112, 1357, 2058, 1566, 5386])
x.add_column("Population", [1158259, 18557594, 120900, 205556, 4336374, 3306092, 1554769])
x.add_column("Annual Rainfall"[600.5, 1146.4, 1714.7, 619.5, 1214.8, 646.9,869.4])
print(dict1)
class AddColumn:
dict1={}
def add_column(self, str1, list1):
self.dict1[str1]=(list1)
def get_dict(self):
print(self.dict1)
x=AddColumn()
# x.add_column( "City Name", ["Adelaide", "Brisbane", "Darwin", "Hobart", "Sydney", "Melbourne", "Perth"])
x.add_column("Area", [1295,5905, 112, 1357, 2058, 1566, 5386])
x.add_column("Population", [1158259, 18557594, 120900, 205556, 4336374, 3306092, 1554769])
x.add_column("Annual Rainfall", [600.5, 1146.4, 1714.7, 619.5, 1214.8, 646.9,869.4])
print(x.get_dict())
Comments
Leave a comment