Question

In: Computer Science

Create a module for sorting and displaying the data Write a module for importing the data...

  1. Create a module for sorting and displaying the data

Write a module for importing the data that includes the following functions:

  1. A function (table_print), that prints the data in the table formatted with two columns of the given width and the given header
    (hint: see lesson 18)

Solutions

Expert Solution

Short Summary:

  • Provided the source code and sample output as per the requirements.

**************Please upvote the answer and appreciate our time.************

Source Code:

import numpy as np
# function table_print
def table_print():
# headre name in a list
teams_list = ["HeaderText", "HeaderText"]
# data as an array
data = np.array([['D1','D2'],
['D4','D5']])
# formatting till the length of the header
row_format ="{:>15}" * (len(teams_list) + 1)
# printing the list
print(row_format.format("", *teams_list))
# iterate through the header and data
for team, row in zip(teams_list, data):
# printing the result
print(row_format.format(team, *row))
  
# calling the function
table_print()

Refer the following screenshots for code indentation:

Sample Run:

**************************************************************************************

Feel free to rate the answer and comment your questions, if you have any.

Please upvote the answer and appreciate our time.

Happy Studying!!!

**************************************************************************************


Related Solutions

By only importing multiprocessing Write a python program which do the following : 1- Create one...
By only importing multiprocessing Write a python program which do the following : 1- Create one process this process must-read the content of a file “read any file content exist in your machine” and after that create another process in the first process function which will get the file content as a parameter for the second process function. 2- The second process function will get the file content and check out if there are any special characters or numbers in...
Data representation is the act of displaying the visual form of your data. The process of...
Data representation is the act of displaying the visual form of your data. The process of identifying the most effective and appropriate solution for representing our data is unquestionably the most important feature of our visualization design. Working on this layer involves making decisions that cut across the artistic and scientific foundations of the field. Here we find ourselves face-to-face with the demands of achieving that ideal harmony of form and function that was outlined in Chapter 6, Data Representation....
For this assignment you are required to create a web page displaying a recipe of your...
For this assignment you are required to create a web page displaying a recipe of your choosing. Your submission should appropriately use the basic head and body construction of an HTML document. Additionally you are required to appropriately use at least three different HTML element types. For example you might use an unordered list for your ingredients, an ordered list for the steps of your recipe, and an image to show the final result. If you choose to use an...
Write a Class called Module with the following attributes: module code, module name, list of lecturers...
Write a Class called Module with the following attributes: module code, module name, list of lecturers for the module (some modules may have more than one lecturer – we only want to store their names), number of lecture hours, and module description. Create a parameterised (with parameters for all of the class attributes) and a non-parameterised constructor, and have the accessor and mutator methods for each attribute including a toString method. Write a class Student with the following attributes: student...
In this lab, you will read and write to a file, as well as sorting the...
In this lab, you will read and write to a file, as well as sorting the information. Copy and paste the following into a file named "inputs.txt": 7 199922007 C.J. Cregg Political_Science 200822013 Olivia Dunham Criminal_Justice 199822007 Josh Lyman Law 199922006 Toby Ziegler Communications 200922015 Leslie Knope Public_and_Environmental_Affairs 199922004 Sam Seaborn Law 200722013 Walter Bishop General_Sciences The input file provides details for a student database in the following format: Number_of_students ID_Number Student_First_Name Student_Last_Name Major …… ID_Number Student_First_Name Student_Last_Name Major Your...
C++ 1.0: Customer Module Create a customer account module to hold the residents details. Use a...
C++ 1.0: Customer Module Create a customer account module to hold the residents details. Use a structure to store the following data about the customer account: Field Description Account No Start with character C and followed by 5 digits (e.g. C10212) Name Resident name Address Current housing address Plot Number Special identifier of the house (3 digits value) Contact No Resident HP number (e.g. 0125354123) Date of Last Payment Date in (dd-mm-yyyy) format. (e.g 15-12-2019) Monthly Payment Amount Example $130.00...
Write a MATLAB code for importing an image and then being able to find all the...
Write a MATLAB code for importing an image and then being able to find all the coordinates that would draw that image on a plot column by column and row by row with a continuous line.
Insertion sort, which is one of the other sorting techniques introduced in this chapter. Create an...
Insertion sort, which is one of the other sorting techniques introduced in this chapter. Create an algorithm to implement an insertion sort. Methods for sorting data files. You should produce a brief report discussing the different sorting options that can be used.
C Language NO ARRAY UTILIZATION OR SORTING Create a .txt file with 20 integers in the...
C Language NO ARRAY UTILIZATION OR SORTING Create a .txt file with 20 integers in the range of 0 to 100. There may be repeats. The numbers must not be ordered/sorted. The task is to find and print the two smallest numbers. You must accomplish this task without sorting the file and without using arrays for any purpose. It is possible that the smallest numbers are repeated – you should print the number of occurrences of the two smallest numbers....
Mergesort is known to be one of the fastest algorithms for sorting lists of data. In...
Mergesort is known to be one of the fastest algorithms for sorting lists of data. In fact, the runtime of mergesort is proportional to n· logn where n is the size of the list to be sorted. Bubblesort, on the other hand is a much slower algorithm, since it's runtime is proportional to n2 , where n is the size of the list to be sorted. As an experiment, mergesort is run on a slow computer, bubblesort is run on...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT