#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Felix Muzny 10/21/2022 DS 2000 Lecture 13 - functions and program design, HW 5 help Logistics: - Homework 5 is due today @ 9pm -> this HW is more difficult than we intended -> you all are doing really impressive work (really!) -> grading will be heavily weighted towards completing the earlier tasks (reading the data in correctly, for example) -> we're not changing the deadlines because we think that it is important for you all to leave crisis mode - Hold tight for news on HW 6, expect this to be released later today -> we are currently auditing it to make sure that we don't have a repeat of the difficulty of HW 5 - what to submit for the homework -> copy+paste the program output, put it after your program description in the header comment of your program as whole - remote attendance (https://bit.ly/remote-ds2000-muzny) Three ways to participate (please do one of these!) 1) via the PollEverywhere website: https://pollev.com/muzny 2) via text: text "muzny" to the number 22333 to join the session 3) via Poll Everywhere app (available for iOS or Android) Given all this information, how are you feeling? A. Better B. About the same C. Worse D. Something else """ """ Functions - parameters and returns, oh my! --- We are going to write one complete program that does three things: 1) read in the sample weather data 2) calculates the minimum temperature 3) graphs the temperature-per-day We'll start from the weather_starter.py file """ # Given all these examples, how are you feeling? # A. Better # B. About the same # C. Worse # D. Something else my_super_long_equation = 123876187236 + 1283710298273891272309 + 18293712987239812 + \ 1238761287236 + 198237981273987 print(my_super_long_equation) """ HW 5 Questions --- In general, program width 1. read_data Please take a look at the examples here: https://piazza.com/class/l5id83u7mlg4fg/post/151 # Super manageable tasks for read_data for HW 5 1) skip the lines starting with "#" 2) read the data into a list of lists (feel free to start from the read_data function in data_utils) 3) make it so only the 6 values I care about are in each row list 4) replace "" with 0.0 5) convert the values to floats than need to be floats 6) convert the values that need fancier conversion What if I hard-coded skipping 34 lines? -> expect to see a -0 in the rubric for this """ """ 2. lookup_planet This is a search function! Example w/ weather data: [['10/19', 13.333333333333334, 0.0], ['10/18', 15.555555555555557, 0.18], ['10/17', 15.555555555555557, 0.16], ['10/16', 19.444444444444446, 0.0]] If I wanted to find the row corresponding to day "10/17", what would I need to do? is there a way to iterate through a list of lists and only look at one column? for row in data: print(row[0]) """ """ 3. euclidean_distance What's going on with all of those triangles??? -> change in value triange_x = x1 - x2 [x1, x2, x3] [y1, y2, y3] ((x1 - y1) ** 2 + (x2 - y2) ** 2 + (x3 - y3) ** 2) ** 0.5 """ """ 4. find_most_similar_planet This is tricky! The basic problem is "how do I find a minimum". 1) finding the min dist 2) finding the planet associated with that min distance - do call the euclidean dist function inside your find_most_similar_planet - expect to either have two loops (not nested) - you don't need a nested loop here """ """ 5. visualize_exoplanets Mass should be on your x-axis, semimajor axis on your y-axis - either annonate or legend ok? yes! (just make it clear which point is earth) - does this function need to be flexible to graph other columns? -> not necessary, you won't lose points either way """