Write the simple getcol tool in python

Assignment Help Python Programming
Reference no: EM132318596

In this assignment you will write the simple getcol tool in Python 3. It extracts a subset of columns of data from a file which has data organized in columns. It is a lot like the tool we built in class. But it has more options and features so you can practice parsing and processing options and then using Python 3.

Here is the help message which is gotten by the default -h option:
Usage: getcol [options] {col{:col{:col}}}*

Options:
-h, --help show this help message and exit
-i STR, --insep=STR input separator
-o STR, --outsep=STR output separator
-l STR, --lastsep=STR
last output separator

-s strip each input column of whitespace
The input separator string is what divides the columns. If none is specified then the default of whitespace is used. See the split function.

The output separator string is what separates columns on output. It is only used between two columns that are printed out. If a column that is to be printed is missing on input then it, of course, is not printed and neither is the separator string (see the test data in the side bar). In Python3 there is the "end=" option on the print function. That is very useful to know about. You saw it briefly in class to prevent a newline from being printed.

The last separator string is what is printed after the list of columns. It is the last thing on the line before the newline.
If the strip flag is set then each column is stripped of white space front and back. There is a simple string function for this.

As many columns as desired can be specified on the command line in a list of columns. Columns are numbered starting at 1. Duplicate column numbers are allowed! The columns are printed in the order they are specified in the column list.

Furthermore each column specifier in the the column list may have zero, one, or two separating colons with no whitespace between. So the column specifier may be a num or num:num or num:num:num. These mean:
num mean that column is to be printed.
num1:num2 means starting at column num1 and going to num2. For example: 1:4 means columns 1, 2, 3, 4.
num1:num2:num3 means starting at column num1 and going to num2 in steps of num3. For example 1:8:3 means columns 1, 4, 7 and 4:1:-1 means 4, 3, 2, 1.

An example column specification might be: 2 2 10:11 8:12:2 10 which would print columns: 2, 2, 10, 11, 8, 10, 12, 10 Consider implementing this feature with the range function.
testing

To test your code and better understand the definition of the functions there is a tar/zip in the sidebar that contains test scripts and a makefile for this assignment.

Submission

Homework will be submitted as an uncompressed tar file to the homework submission page linked from the main class page. No makefile is needed for a Python program. Your pogram will be named getcol with no py extension. To invoke Python 3 you put:

#!/usr/bin/env python3 as the first line of your program. This will let you use the python3 that is installed in local environment. FYI: it is Python 3.4. Have fun.

You can submit as many times as you like. The LAST file you submit BEFORE the deadline will be the one graded. For all submissions you will receive email giving you some automated feedback on the unpacking and compiling and running of code and possibly some other things that can be autotested. I will read the results of the runs and the reports you submit.

Reference no: EM132318596

Questions Cloud

Create five to seven interactive math games : For this benchmark, you will plan a Family Math Game Event. You will create five to seven interactive math games for one of the following age groups.
Can the teacher participate in its activities : Do all student-led religious groups have an absolute right to meet at K-12 schools? If not, discuss one limitation under the Equal Access Act. May a teacher be.
Calculate basic eps for the three years : What would Niglow's return on net operating assets need to be for the return on equity to be decreased by financing the expansion using all debt.
How each of the strategies can contribute to your success : Explain how each of these strategies can contribute to your success in online learning. Be sure to practice citing and referencing the course resources you use.
Write the simple getcol tool in python : CS 270 - System Software - University of Idaho - Write the simple getcol tool in Python 3. It extracts a subset of columns of data from a file which has data
How you will maintain your dispositions in the classroom : How you will maintain your dispositions in the classroom, through demonstrating ethical behavior in instruction and assessment.
Which of the following would be the required journal entry : Target Corp. borrowed $106,000 cash on September 1, 2014, and signed a one-year 6%, interest-bearing note payable.
Discuss how you will report the results to families : Discuss how you will report the results to families. Provide at least three tips for families about how they can communicate with you about concerns/questions.
Write down description of weather during games time : For this assignment, you will first select your topic (a city from North America) on the Discussion Board. You may not select a city that has been previously.

Reviews

Write a Review

Python Programming Questions & Answers

  Review the functional requirements section

Review the Functional Requirements section and make sure you hit all the points. This will not guarantee a perfect score, however

  Create a list of valid entries and correct results for sets

Create a list of valid entries and the correct results for each set of entries. Then, make sure that the results are correct when you test with these entries.

  Write a python program

Write a Python program

  Write a program using the ''requetinteger''

using python/jython programming write a program using the 'requetInteger' function that will ask the user to type a value that will draw a line from one point on a picture to another. I don't need specific help just a gerneral idea.

  Write single file python program in jupyter notebook format

BUAN 6340 - Programming for Data Science Programming Lab. You will write a single file Python program in Jupyter Notebook format

  Describe an application you would like to be able to develop

Describe an application/program you would like to be able to develop. Think about a problem you would like to be able to solve or perhaps something.

  Prepare program that will compute tip and tax on meal price

CS21A Lab 3: Functions- Write a program that will calculate a XXX% tip and a 6% tax on a meal price. Python comes with a standard library of functions. Some of the functions that you have used already are input, type, and range.

  Write a python program to demonstrate a theme for your robot

Write a Python program to demonstrate a theme for your robot. Your team must think of something fc your robot to do using the sensors and/or motors.

  Write a python script that reads and analyses the pizza data

ICT702 - Data Wrangling - University of the Sunshine Coast - Write a Python script that reads and analyses the pizza data file (Weekly_Sales.csv)

  Write Python program that generates an informative web site

ICT112 Assignment - Generated Web Site for Aussie Airport Passenger Movements. University of the Sunshine Coast. write a Python program that generates a site

  Write appropriate accessor and mutator methods

Design a class that holds the following personal data: name, address, age, and phone number. Write appropriate accessor and mutator methods.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd