Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question

The programming language is - Python

a. Write a function called daysOver that takes three arguments: a dictionary, a location (such as ‘Sydney’, ‘Adelaide’,etc) and a temperature and returns the number of days that were over the given temperature for the given location. For example, if we call the function using the line:

total = daysOver(dictionaryData, ‘Adelaide’, 40)

total will hold the number of days that Adelaide had a temperature greater than 40 celsius in the data. As a test, there were 54 days over 40 celsius in the data. Check that total is 54 for the example when you run your code.

b. Use the daysOver function to print the number of days over 35 celsius for each of the following cities: 'Adelaide','Perth','Melbourne','Canberra','Sydney','Brisbane','Darwin'

c. Which of the Australian cities has the most number of days over 35 celsius?

My spreadsheet looks like this

Since I cannot attach an excel file, my excel file name is "weatherAUS.csv"

[画像:14 13/12/08,Albury,15.9,18.6,15.6,NA,NA,W,61,NNW,NNW,28,28 76 93.994.3,993 9 0 17 A158,Yes,3.6,Yes 19 19/12/08 Albvun, 14 a 22.5,10.6.NA ANA CEE A3. WSw,Sw.24 17 A7.32,1009.4,1009 7 NA A AEE21 Yes 0.No A1 v fx Date,Location,MinTemp,MaxTemp,Rainfall,Evaporation,Sunshine,WindGustDir,WindGustSpeed,WindDir9am,WindDir3pm,WindSpeed9am,WindSpeed3pm,Humidity9am,Humidity3pm,Pressure9am, v E F G H I K L M N O Q R S| T A B P 1 Date,Locatioh, MinTemp, MaxTemp, Rainfall,Evaporation,Sunshine,WindGustDir, WindGustSpeed, WindDir9am,WindDir3pm,WindSpeed9am,WindSpeed3pm, Humidity9am, Humidity3pm,Pressure9am,Pressure3pm,Cloud9am,Cloud3pm, Temp9am,Temp3pm,RainTod 2 1/12/08,Albury,13.4,22.9,0.6,NA,NA,W,44,W,WNW,20,24,71,22,1007.7,1007.1,8,NA,16.9,21,8,No,0,No 3 2/12/08,Albury,7.4,25.1,0,NA, NA,WNW,44,NNW,WSw,4,22,44,25,1010.6,1007.8,NA,NA,17.2,24.3,No,0,No 4 3/12/08,Albury, 12.9,25.7,0,NA, NA,WSW,46,w,wsw,19,26,38,30,1007.6,1008.7,NA,2,21,23.2,No,0,No 5 4/12/08,Albury,9.2,28,0,NA,NA,NE,24,SE,E,11,9,45,16,1017.6,1012.8,NA,NA,18.1,26.5,No,1,Mo 6 5/12/08,Albury,17.5,32.3,1,NA, NA,W,41,ENE,NW,7,20,82,33,1010.8,1006,7,8,17.8,29.7,No,0,2,No 7 6/12/08,Albury,14.6,29.7,0.2,NA,NA,WNW,56,W,W,19,24,55,23,1009.2,1005.4,NA,NA,20.6,28.9,No,0,No 8 7/12/08,Albury,14.3,25,0,NA,NA,W,50,SW,W,20,24,49,19,1009.6,1008.2,1,NA,18.1,24.6,No,0,No 9 8/12/08,Albury,7.7,26.7,0,NA,NA,W,35,SSE,W,6,17,48,19,1013.4,1010.1,NA,NA,16.3,25.5,No,0,No 10 9/12/08,Albury,9.7,31.9,0,NA,NA,NNW,80,SE,NW,7,28,42,9,1008.9,1003.6,NA,NA, 18.3,30.2, No,1.4,Yes 11 10/12/08,Albury, 13.1,30.1,1.4,NA,NA,W,28,S,SSE,15,11,58,27,1007,1005.7,NA,NA,20.1,28.2,Yes,0,No 12 11/12/08,Albury, 13.4,30.4,0,NA,NA,N,30,SSE,ESE,17,6,48,22,1011.8,1008.7,NA, NA,20.4,28.8 No,2.2,Yes 13 12/12/08,Albury, 15.9,21.7,2.2,NA,NA,NNE,31,NE,ENE,15,13,89,91,1010.5,1004.2,8,8,15.9,17 Yes,15.6,Yes 15 14/12/08,Albury, 12.6,21,3.6,NA,NA,SW,44,W,ssw,24,20,65,43,1001.2,1001.8,NA,7,15.8,19.8,Yes,0,No 16 16/12/08,Albury,9.8,27.7,NA,NA,NA,WNW,50,NA,WNW,NA,22,50,28,1013.4,1010.3,0,NA,17,3,26.2,NA,0,No 17 17/12/08,Albury,14.1,20.9,0,NA,NA,ENE,22,SSW,E,11,9,69,82,1012.2,1010.4,8,1,17.2,18.1,No,16.8,Yes 18 18/12/08,Albury,13.5,22.9,16.8,NA,NA, W,63,N,WNW,6,20,80,65,1005.8,1002.2,8,1,18,21.5,Yes,10.6,Yes 19 19/12/08,Albury,11.2,22.5,10.6,NA, NA,SSE,43,WSW,sw,24,17,47,32,1009.4,1009.7,NA,2,15.5,21,Yes,0,No 20 20/12/08,Albury,9.8,25.6,0,NA,NA,SSE,26,SE,NNW,17,6,45,26,1019.2,1017.1,NA,NA,15.8,23.2,No,0,No 21 21/12/08,Albury,11.5,29.3,0,NA,NA,S,24,SE,SE,9,9,56,28,1019.3,1014.8,NA,NA,19.1,27.3,No,),No 22 22/12/08,Albury,17.1,33,0,NA, NA, NE,43,NE,N,17,22,38,28,1013.6,1008.1,NA,1,24.5,31.6,No,),No 23 23/12/08,Albury,20.5,31.8,0,NA,NA,WNW,41,W,W,19,20,54,24,1007.8,1005.7,NA,NA,23.8,30.8,No,0,No 24 24/12/08,Albury,15.3,30.9,0,NA, NA,N,33,ESE,Nw,6,13,55,23,1011,1008.2,5,NA,20.9,29,No,0 No 25 25/12/08,Albury,12.6,32.4,0,NA,NA,W,43,E,W,4,19,49,17,1012.9,1010.1,NA,NA,21.5,31.2,No,0,No 26 26/12/08,Albury,16.2,33.9,0,NA,NA,WSW,35,SE,wsw,9,13,45,19,1010.9,1007.6,NA,1,23.2,33,No,0,No 27 27/12/08,Albury, 16.9,33,0,NA, NA,WSW,57,NA,W,0,26,41,28,1006.8,1003.6,NA,1,26.6,31.2,No,0,No *** ** -* sor s weatherAUS ]
expand button
Transcribed Image Text:14 13/12/08,Albury,15.9,18.6,15.6,NA,NA,W,61,NNW,NNW,28,28 76 93.994.3,993 9 0 17 A158,Yes,3.6,Yes 19 19/12/08 Albvun, 14 a 22.5,10.6.NA ANA CEE A3. WSw,Sw.24 17 A7.32,1009.4,1009 7 NA A AEE21 Yes 0.No A1 v fx Date,Location,MinTemp,MaxTemp,Rainfall,Evaporation,Sunshine,WindGustDir,WindGustSpeed,WindDir9am,WindDir3pm,WindSpeed9am,WindSpeed3pm,Humidity9am,Humidity3pm,Pressure9am, v E F G H I K L M N O Q R S| T A B P 1 Date,Locatioh, MinTemp, MaxTemp, Rainfall,Evaporation,Sunshine,WindGustDir, WindGustSpeed, WindDir9am,WindDir3pm,WindSpeed9am,WindSpeed3pm, Humidity9am, Humidity3pm,Pressure9am,Pressure3pm,Cloud9am,Cloud3pm, Temp9am,Temp3pm,RainTod 2 1/12/08,Albury,13.4,22.9,0.6,NA,NA,W,44,W,WNW,20,24,71,22,1007.7,1007.1,8,NA,16.9,21,8,No,0,No 3 2/12/08,Albury,7.4,25.1,0,NA, NA,WNW,44,NNW,WSw,4,22,44,25,1010.6,1007.8,NA,NA,17.2,24.3,No,0,No 4 3/12/08,Albury, 12.9,25.7,0,NA, NA,WSW,46,w,wsw,19,26,38,30,1007.6,1008.7,NA,2,21,23.2,No,0,No 5 4/12/08,Albury,9.2,28,0,NA,NA,NE,24,SE,E,11,9,45,16,1017.6,1012.8,NA,NA,18.1,26.5,No,1,Mo 6 5/12/08,Albury,17.5,32.3,1,NA, NA,W,41,ENE,NW,7,20,82,33,1010.8,1006,7,8,17.8,29.7,No,0,2,No 7 6/12/08,Albury,14.6,29.7,0.2,NA,NA,WNW,56,W,W,19,24,55,23,1009.2,1005.4,NA,NA,20.6,28.9,No,0,No 8 7/12/08,Albury,14.3,25,0,NA,NA,W,50,SW,W,20,24,49,19,1009.6,1008.2,1,NA,18.1,24.6,No,0,No 9 8/12/08,Albury,7.7,26.7,0,NA,NA,W,35,SSE,W,6,17,48,19,1013.4,1010.1,NA,NA,16.3,25.5,No,0,No 10 9/12/08,Albury,9.7,31.9,0,NA,NA,NNW,80,SE,NW,7,28,42,9,1008.9,1003.6,NA,NA, 18.3,30.2, No,1.4,Yes 11 10/12/08,Albury, 13.1,30.1,1.4,NA,NA,W,28,S,SSE,15,11,58,27,1007,1005.7,NA,NA,20.1,28.2,Yes,0,No 12 11/12/08,Albury, 13.4,30.4,0,NA,NA,N,30,SSE,ESE,17,6,48,22,1011.8,1008.7,NA, NA,20.4,28.8 No,2.2,Yes 13 12/12/08,Albury, 15.9,21.7,2.2,NA,NA,NNE,31,NE,ENE,15,13,89,91,1010.5,1004.2,8,8,15.9,17 Yes,15.6,Yes 15 14/12/08,Albury, 12.6,21,3.6,NA,NA,SW,44,W,ssw,24,20,65,43,1001.2,1001.8,NA,7,15.8,19.8,Yes,0,No 16 16/12/08,Albury,9.8,27.7,NA,NA,NA,WNW,50,NA,WNW,NA,22,50,28,1013.4,1010.3,0,NA,17,3,26.2,NA,0,No 17 17/12/08,Albury,14.1,20.9,0,NA,NA,ENE,22,SSW,E,11,9,69,82,1012.2,1010.4,8,1,17.2,18.1,No,16.8,Yes 18 18/12/08,Albury,13.5,22.9,16.8,NA,NA, W,63,N,WNW,6,20,80,65,1005.8,1002.2,8,1,18,21.5,Yes,10.6,Yes 19 19/12/08,Albury,11.2,22.5,10.6,NA, NA,SSE,43,WSW,sw,24,17,47,32,1009.4,1009.7,NA,2,15.5,21,Yes,0,No 20 20/12/08,Albury,9.8,25.6,0,NA,NA,SSE,26,SE,NNW,17,6,45,26,1019.2,1017.1,NA,NA,15.8,23.2,No,0,No 21 21/12/08,Albury,11.5,29.3,0,NA,NA,S,24,SE,SE,9,9,56,28,1019.3,1014.8,NA,NA,19.1,27.3,No,),No 22 22/12/08,Albury,17.1,33,0,NA, NA, NE,43,NE,N,17,22,38,28,1013.6,1008.1,NA,1,24.5,31.6,No,),No 23 23/12/08,Albury,20.5,31.8,0,NA,NA,WNW,41,W,W,19,20,54,24,1007.8,1005.7,NA,NA,23.8,30.8,No,0,No 24 24/12/08,Albury,15.3,30.9,0,NA, NA,N,33,ESE,Nw,6,13,55,23,1011,1008.2,5,NA,20.9,29,No,0 No 25 25/12/08,Albury,12.6,32.4,0,NA,NA,W,43,E,W,4,19,49,17,1012.9,1010.1,NA,NA,21.5,31.2,No,0,No 26 26/12/08,Albury,16.2,33.9,0,NA,NA,WSW,35,SE,wsw,9,13,45,19,1010.9,1007.6,NA,1,23.2,33,No,0,No 27 27/12/08,Albury, 16.9,33,0,NA, NA,WSW,57,NA,W,0,26,41,28,1006.8,1003.6,NA,1,26.6,31.2,No,0,No *** ** -* sor s weatherAUS
Expert Solution
Check Mark
Still need help?
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Hi there

Is it possible write the output of the function to a csv file? or point me towards a tutorial that covers this aspect.

Cheersb

Solution
Bartleby Expert
by Bartleby Expert
SEE SOLUTION
Follow-up Question

Hi there.

Thank you for this response. Is it possible to then export the output to a csv file when say 40 is passed in as the temperature argument?

eg

City, Temp Count

Adelaide, 54

Perth, 28...

Solution
Bartleby Expert
by Bartleby Expert
SEE SOLUTION
Follow-up Question

Im getting a Key Error in this code

Can someone confirm.

Solution
Bartleby Expert
by Bartleby Expert
SEE SOLUTION
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Hi there

Is it possible write the output of the function to a csv file? or point me towards a tutorial that covers this aspect.

Cheersb

Solution
Bartleby Expert
by Bartleby Expert
SEE SOLUTION
Follow-up Question

Hi there.

Thank you for this response. Is it possible to then export the output to a csv file when say 40 is passed in as the temperature argument?

eg

City, Temp Count

Adelaide, 54

Perth, 28...

Solution
Bartleby Expert
by Bartleby Expert
SEE SOLUTION
Follow-up Question

Im getting a Key Error in this code

Can someone confirm.

Solution
Bartleby Expert
by Bartleby Expert
SEE SOLUTION
Knowledge Booster
Background pattern image
Similar questions
    Recommended textbooks for you
    Text book image
    Computer Networking: A Top-Down Approach (7th Edi...
    Computer Engineering
    ISBN:9780133594140
    Author:James Kurose, Keith Ross
    Publisher:PEARSON
    Text book image
    Computer Organization and Design MIPS Edition, Fi...
    Computer Engineering
    ISBN:9780124077263
    Author:David A. Patterson, John L. Hennessy
    Publisher:Elsevier Science
    Text book image
    Network+ Guide to Networks (MindTap Course List)
    Computer Engineering
    ISBN:9781337569330
    Author:Jill West, Tamara Dean, Jean Andrews
    Publisher:Cengage Learning
    Text book image
    Concepts of Database Management
    Computer Engineering
    ISBN:9781337093422
    Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
    Publisher:Cengage Learning
    Text book image
    Prelude to Programming
    Computer Engineering
    ISBN:9780133750423
    Author:VENIT, Stewart
    Publisher:Pearson Education
    Text book image
    Sc Business Data Communications and Networking, T...
    Computer Engineering
    ISBN:9781119368830
    Author:FITZGERALD
    Publisher:WILEY