This is a question for one of my class assignments that I have tried solving for days...1) As you already know, we can have a list within a list in python. This feature enables us to make tables in python using lists. Create a list variable called student_info with the information below.
Name Color Lang Food
Arya Blue Python Sushi
Jon Yellow C++ Pasta
Sansa Green Java Taco
Bran Purple Julia Pizza
You can start by creating a seperate list for each row of the table by typing the sequence of data points of a row. Create the list by assigning it to a variable named row_1. Now let’s do the same for the other rows and create five lists, one for each row in our dataset. Finally append these rows to the table list called table_list.
In my code I tried this however I am stuck on how I am supposed to append multiple items into table_list. I cannot use for loops. This was my attempt but I keep getting assertion errors. Any help is appreciated.
student_info = ['Name','Color','Lang','Food'] row_1 = ['Arya','Blue','Python','Sushi'] row_2 = ['Jon','Yellow','C++','Pasta'] row_3 = ['Sansa','Green','Java','Taco'] row_4 = ['Bran','Purple','Julia','Pizza'] table_list = [] table_list.extend[row_1, row_2, row_3, row_4 ]