00:01
Hello student, here the python code is written here.
00:04
So this code first define a function called create underscore table.
00:08
So this function take a list of the string as the input and return a list of the string each representing a table.
00:14
The function first create a new list called table.
00:17
Next the function iterates over the list of the string and create the three table.
00:22
The first table contains the department code and the course number for each row.
00:27
The second table contains all the data in each row with a single space between each piece and the third table truncate the title to the number of the character shown but was out of short title.
00:40
So it also make sure the enrollment all line up as shown.
00:45
The function also add up all the enrollment and prints the total in the third table.
00:50
Finally the function return the list of the table.
00:53
So this code the code then calls the create underscore table function and print the result.
01:00
So here i have written create underscore table.
01:04
So here i am passing argument as a data and here i have written the comment create table from the given data.
01:11
So data will be given to us and we have to create the table.
01:14
Arguments here will be the data a list of the string representing department code, course number, title and enrollment.
01:22
So these will be the list strings and return a list of the string each representing a table.
01:29
So here at the starting i have taken the empty table.
01:33
Now table one department code and the course number.
01:37
So here for the table one i have to create this table department code and the course number.
01:42
So table dot append this table will be appended by the table one.
01:47
So for row in data department underscore code and the course underscore number equal to up to row two here string slicing is done and we are taking the data from the starting up to the two minus one.
02:03
So here data table will be appended with the format.
02:07
So here data table having the columns department code and the course number.
02:14
So table will be look like this which will be appended in the table.
02:18
So this table having the two field one is department code and second one is the course number.
02:27
So second field will be the course number...