Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Filename: nola_v2.py Input files: nola weather feb. csv, same as for the previous problem Remember the Euclidean distance computation we used back in HW2? Back

image text in transcribed
image text in transcribed
image text in transcribed
Filename: nola_v2.py Input files: nola weather feb. csv, same as for the previous problem Remember the Euclidean distance computation we used back in HW2? Back then, we computed the distance between two locations in physical space. Data scientists use distance measures for all kinds of things, not just physical distance, and for this problem we'll use it to compare days based on the weather. Given an ideal weather forecast, we'll find the year that was the closest to that ideal. First, prompt the user for their ideal weather conditions: ideal high temp, low temp, and humidity. Compute the mean from their high and low. Create a list with their ideal high_temp, low_temp, mean, humidity. Second, let's compare! We're using the same data file as for nola_v1, but we're reading it in differently. For each line in the file, create a list containing high_temp, low_temp, mean, humidity, in that order. Compute the Euclidean distance between the current year and the ideal weather. At the end, report back to the user the year with the weather that's closest to their ideal, and the distance. Euclidean Distance Note that your prompt the user for three things (low, high, humidity), but the list you create from their input will have length 4 (high, low, mean, humidity). Make sure the list you create from the file, for each year, is the same length and in the same order. Then you can apply the following: - Given two lists, 11 and 12, of length n, Euclidean distance is defined as: - sqrt((11[0]12[0])2+(11[1]12[1])2+(11[n1]12[n1])2) Note that 2-dimensional lists are not permitted on this homework. You can accomplish everything here with the lists and loops we've covered in class! mala vud-akb- r-a For full credit under documentation, you must include at least one test case in a block comment at the top of your code. This doesn't have to include the actual closest year and its weather conditions! Something like this, but with your own example. Test case: Idea 7 ; 70,50,56 Ideal list becomes: [7,50,60,56] Distance from here to 1937 71,48,59,5,55 (771)k+(5048)2+(6e59.5)2+(5655)+2 =1+4+.25+1 And then sqrt (6.25)=2.5 Here's an example of what happens when I run my code (as always, yours doesn't need to look exactly the same, but the prompts DO need to be in the same order to make the autograder happy)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

Define self-esteem and discuss its impact on your life.

Answered: 1 week ago