Question

In: Computer Science

The following table represents the average temperatures in San Francisco for the first three months of...

The following table represents the average temperatures in San Francisco for the first three
months of 2017 and 2018. Use Python

2017    2018
Days Jan Feb March Jan Feb March
1 50 52 42 51 62 54
2 48 57 43 55 62 51
3 52 58 44 55 63 48
4 52 57 51 58 64 48
5 46 56 50 59 63 51

1. Using this table, create 2 Nested Lists, one for each year.

Call those lists temp_2017 and temp_2018.
Each of those lists is composed of 3 sequence of values. Each sequence corresponds to a
month and is composed of 5 temperatures.   

2. Using the created nested lists, write a script that display:

a. The temperatures for each of the first 5 days of February 2017
b. The temperatures for each of the third, fourth and fifth day of March 2018
c. The temperature for January 3rd, 2018

Solutions

Expert Solution

data.txt:

Days,Jan,Feb,March,Jan,Feb,March
1,50,52,42,51,62,54
2,48,57,43,55,62,51
3,52,58,44,55,63,48
4,52,57,51,58,64,48
5,46,46,50,59,63,51

#code:

f=open("date.txt","r")
hole_data=[]
for l in f.readlines():
   temp=l.replace("\n","")
   hole_data.append(temp.split(","))
main_list=[]
months=hole_data[0]
for i in range(0,7):
   sub_list=[]
   for j in range(1,6):
       sub_list.append(int(hole_data[j][i]))
   main_list.append(sub_list)
output=[]
for i in range(1,len(main_list)):
   sub=[months[i],main_list[0],main_list[i]]
   output.append(sub)
temp_2017=output[0:3]
temp_2018=output[3:]
print(temp_2017)
print(temp_2018)
print("Feb:",temp_2017[1])
print("March: Third {} forth {} fifth {} ".format(temp_2018[2][2][2],temp_2018[2][2][3],temp_2018[2][2][4]))
print("Jan: Third {} 2018".format(temp_2018[0][2][2]))
          
      

#output:

#if you have any doubts comment below...


Related Solutions

The following table provides the number of men infected with HIV in San Francisco from 1982...
The following table provides the number of men infected with HIV in San Francisco from 1982 to 1990. Year Quantity Delaware infected 1982 80 1983 300 1984 700 1985 1500 1986 2500 1987 3,500 1988 4500 1989 6000 1990 7200 Estimate the inflection point of the data and try a brief explanation of its meaning in this context.
] The average cost per night of a hotel room in San Francisco is $550 with...
] The average cost per night of a hotel room in San Francisco is $550 with a standard deviation is $150 based on a sample of 50 hotel room rates. a) Clearly state what the random variable in this problem is? b) What is an appropriate distribution to be used for finding the confidence intervals for this problem and why? c) Construct a 99% confidence interval estimate on the mean of all hotel room rates. d) What is the 90%...
5. The table below shows actual temperatures and predicted temperatures for San Antonio from August 01...
5. The table below shows actual temperatures and predicted temperatures for San Antonio from August 01 through 15th. https://www.accuweather.com/en/us/san-antonio-tx/78205/august-weather/351198 Day Temperature 1 100 2 100 3 99 4 98 5 101 6 100 7 101 8 102 9 103 10 103 11 104 12 104 13 104 14 103 15 100 a. Decide which variable should be the independent variable and which should be the dependent variable. b. Draw a chart for the data. Make sure to show the equation...
5. The table below shows actual temperatures and predicted temperatures for San Antonio from August 01...
5. The table below shows actual temperatures and predicted temperatures for San Antonio from August 01 through 15th. https://www.accuweather.com/en/us/san-antonio-tx/78205/august-weather/351198 Day Temperature 1 100 2 100 3 99 4 98 5 101 6 100 7 101 8 102 9 103 10 103 11 104 12 104 13 104 14 103 15 100 a. Decide which variable should be the independent variable and which should be the dependent variable. b. Draw a chart for the data. Make sure to show the equation...
The following table shows the market shares during the first three months of 2017 for companies...
The following table shows the market shares during the first three months of 2017 for companies in the US personal computer (PC) market: Company Market Share Lenovo 20% Hewlett-Packard 20% Dell 15% ASUS 7% Apple 7% ACER 6% Others 25% Treating “Others” as a single firm, how would the “Agencies” characterize the concentration level in this market? How does your answer change if “Others” consists of 5 firms each with 5% market share? Explain/Show Work. USE HHI Treating “Others” as...
The frequency distribution below shows the distribution of average seasonal rainfall in San Francisco, as measured...
The frequency distribution below shows the distribution of average seasonal rainfall in San Francisco, as measured in inches, for the years 1967-2017. (Show all work. Not Just the answer.) Season Rainfall (in Inches) Frequency Cumulative Relative Frequency 0 - 9.99 1 10 - 19.99 22 20 - 29.99 0.84 30 - 30.99 0.98 40 - 40.99 1.00 Total 50 (a) Why is it appropriate to use a grouped frequency distribution for this data? (b) Complete the frequency table with frequency...
The average monthly rent for a 1-bedroom apartment in San Francisco ranges from approximately $2500 to...
The average monthly rent for a 1-bedroom apartment in San Francisco ranges from approximately $2500 to $3700, depending on the neighborhood. A rent control policy setting $2000 per month rent on apartments is being considered in San Francisco, where the demand for apartments is given by P = 5000 − Q and the supply of apartments is P = 1000 + Q. Here, P = dollars of monthly rent, and Q = number of apartments available for rent. For purposes...
A researcher wished to compare the average daily hotel room rates between San Francisco and Los...
A researcher wished to compare the average daily hotel room rates between San Francisco and Los Angeles. The researcher obtained an SRS of 15 hotels in downtown San Francisco and found the sample mean ? ̅1=$156, with a standard deviation ?_1= $15. The researcher also obtained an independent SRS of 10 hotels in downtown Los Angeles and found the sample mean ? ̅_2= $143, with a standard deviation ?_2= $10. Let 1 and 2 represent the mean cost of the...
An industrial company is planning to build plants in three cities: Boston, San Francisco and Tennessee....
An industrial company is planning to build plants in three cities: Boston, San Francisco and Tennessee. The company needs to produce at least 40,000 units each year to satisfy the demand. Each plant has a certain capacity and there is an annual fixed cost to set up the plants and a variable cost per each unit produced. The following table provides the costs associated with each location. Location Annual Fixed Cost Variable Cost Annual Capacity Boston $350,000 $20 20,000 San...
Which of the following statistics associated with the Golden Gate Bridge in San Francisco, California, are...
Which of the following statistics associated with the Golden Gate Bridge in San Francisco, California, are exact numbers and which have some inherent uncertainty? Part 1: The roadway is six lanes wide. Choose one: A. Exact number B. number with limited precision. Part 2: The width of the bridge is 27.4 m. Choose one: A. exact number B. number with limited precision Part 3: The bridge has a mass of 3.808x108 kg. Choose one: A. exact number B. number with...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT