Title Printing Table of Medal Counts with Row/Column Total
Catalog Type SLCItem
Persistent ID https://pawscomp2.sis.pitt.edu/pcex/pcex_v2/index.html?lang=PYTHON&set=py_print_medals&ch=py_print_medals_row_column_total
Platform Name PCEX
Features
Description Assume that we have a 7x4 matrix that stores the number of medals that seven countries won in the skating competitions at the Winter Olympic. This matrix looks like as follows:\n[[ "Canada", 1, 0, 1 ],\n [ "China", 1, 1, 0 ],\n ...]\nEach row of this matrix corresponds to the medal counts for the country in that row. The second, third, and fourth numbers within a row represent the number of Gold, Silver, and Bronze medals won by the corresponding country in that row.\nConstruct a program that takes this matrix and prints a table of medal counts with row and column totals. The column totals are the sum of the gold, silver, and bronze medals won in the competition. The output table should look like as follows:\n Country Gold Silver Bronze Total\n Canada 1 0 1 2\n China 1 1 0 2\n ...\nColumn Total 4 4 4
Keywords 2d list, for loop
Author Kamil Akhuseyinoglu
Institution University of Pittsburgh
Iframe URL https://pawscomp2.sis.pitt.edu/pcex/pcex_v2/index.html?lang=PYTHON&set=py_print_medals&ch=py_print_medals_row_column_total
Protocol PITT, HTML
Protocol URL
License MIT
Programming Language Python
Natural Language en

Preview