I have a lab assignment that i need help on and don't know where to start
Microsoft Word - CMPT 103 - Lab 8.docx 1 CMPT103 – Lab 8 General Information Python version / IDE Python 3 / Wing IDE 101 Lab time 2 hours and 50 minutes Due date As communicated by your lab instructor Lab weight 3% Topics ✓ Files ✓ Error handling ✓ graphics.py and setCoords ✓ Graphical user interfaces (GUIs) Submission ✓ All the code files (.py) should be submitted electronically according to the instructions from your lab instructor. ✓ A portion of the total marks (20%) will be allocated to programming style. For example, functions should be small (generally 20 lines of code or fewer); names should be meaningful and descriptive; naming conventions should be followed consistently; code should be formatted properly; and comments should be accurate and well written. ✓ Comments are required for: – the program indicating the program purpose, the student’s name, and the statement of ownership – EACH function indicating the function purpose, parameters, and return value. – Any block of code for which the purpose may be unclear. Note: you should always try to write code that can be understood easily without comments. Assignment For this lab, please put all functions into a file named Lab_8_XX.py (where XX is replaced with your initials). In this lab, you will create a Python program that 2 • loads temperatures from a file, • plots those temperatures as a line graph, • plots a legend describing the lines, and • when the user clicks in the window, displays the temperature for the point where the user clicked. See the following mock-up of a minimal interface: As you work on this assignment, think about potential errors that could occur. At no point should your program terminate with an exception. Your program must work with files formatted as comma-separated values (CSV). These files will consist of one to five lines, where each line provides up to 31 temperatures for that single city. For example: City A,25,24.1,26.6,…,30.1 City B,20.4,22.4,21.3,…,33.3 When you first launch the program (click the Play button in Wing 101), the program must prompt the user for a filename. The user provides the filename, and the program will attempt to open and load the file. Load the file into a dictionary of lists. For the keys, use the city names, and each corresponding value will be a list of temperatures (in the form of integers) for that city. For example, the prompt and user response might look like the following: Filename for CSV file: ab.csv 3 If the file cannot be loaded, it must not cause an exception. After loading in the available data, the program creates a plot of the data in a 500×500 pixel window. The domain of this plot is 1 to 31 (inclusive), and the range is -50 to 50 (inclusive). For each city from the data file, the plot must contain one line (consisting of multiple graphics.pyLine objects). Each line must appear in a different colour. Recommended colours: "red", "green", "blue", "black", and "orange". The plot must also include a brief legend in the top-left corner: each city name must appear in the same colour as the line. At the bottom of the plot, the text Value: N/A initially appears. The window must allow the user to click multiple times within it. When the user clicks at a point, the label at the bottom must be updated to reflect the location (y-value) of the click, e.g., Value: 24.23 . The floating-point value should be rounded to two decimal places. When the user closes the window, it must not cause an exception. Hint • the GraphWin method toWorld(…) may help you place Text objects after you’ve called the method setCoords(…) Mark breakdown Task Marks Opening a file 10 Building the dictionary 20 Creating the graphics window and drawing the graph 30 Responding to mouse clicks 20 Documentation and programming style 20