Answer to Question #255509 in Python for Angelie Suarez

Question #255509

Recreate the pokemon table using Colum by column on the documentation:

Column by column

you can add data one column at a times as well. To do this you use the add_column method, which takes who arguments-a string which is the name for the field the column you are adding corresponds to, and a list or tuple which contains the column data:


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])


1
Expert's answer
2021-10-23T13:53:48-0400
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)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS