Python Programming Questions- reading from csv

User Generated


Computer Science


1. Design and implement a program to draw x/y plots. Your program will read a file of X/Y coordinates and plot them on the window frame. The files to plot are: Sin.csv, Cos.csv, Square.csv, Cube.csv, Polynomial.csv and your program should be able to read and plot any of the files. At the intersection of each line, draw the shape of your choice (like a circle, triangle or rectangle). You may find that overloading of some operators makes plotting techniques easier.

Your program will design and implement several classes to do the plotting. Suggested classes:
* Write a UDT (user defined type) that manages the files.
* Write a UDT that manages X and Y Cartesian coordinate pairs.
* Write a UDT that draws a line between two points.
* Write a UDT that draws a Plot Graph

See the and examples for guidelines on creating the classes. Some of the classes can be used as-is, or even refactored. Use comprehensions where applicable.

The data will need to be scaled to fit the screen. Here is a data file excerpt:
Notice in this excerpt the Y coordiates are, while the X coordiates are between 0 and 90. If the Y coordinates were plotted without scaling, a flat line would be drawn. Note the X coordinates will require some scaling to fit the screen.

2. In the movie “The Martian” 2015, the “Martian” (Matt Damon) devises a clever scheme of adapting the Ascii table to a 360°circle.The numbers 0 thru 9 and A thru F (see HexTable below) are placed on cards spaced at 22.5 degree increments in a circle (see HexDegrees circle below) around the Sojourner Martian lander:


Hex/Ascii Circle


Hex Table


Hex Degrees


Example "Martian"



A. Implement an algorithm(s) (using class/objects) to convert Degree pairs to Hex pairs. A reminder about Object Oriented Programming is a Class should have ONE responsibility (not multiple).

B. Read the 'HexDegrees.csv' file and translate the Degree/Hex Pairs to English.

C. This is an ideal lab to use Dictionaries instead of Lists.

D. Minimize the number of IF statements in your program. Too many IF statements often indicate an inefficient design.

Data File Excerpt


Files are attached.

Explanation & Answer:
1 Task
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer


Great study resource, helped me a lot.


Related Tags