Title Printing Table of Medal Counts with Row Totals
Catalog Type SLCItem
Persistent ID https://acos.cs.vt.edu/html/acos-pcex/acos-pcex-examples/py_print_medals__664e42de91363872f0ba36f1?index=0
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 total that shows the number of Gold, Silver, Bronze, and Total medals for each of the countries who participated 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 ...\n
Keywords
Author Mohammad Hassany
Institution University of Pittsburgh
Iframe URL https://acos.cs.vt.edu/html/acos-pcex/acos-pcex-examples/py_print_medals__664e42de91363872f0ba36f1?index=0
Protocol SPLICE
Protocol URL
License MIT
Programming Language PYTHON
Natural Language en

Preview

SPLICE Output