Question: Reading the data into a list You are surprised that the hottest year on record in Sacramento was more than a century ago! You decide
Reading the data into a listÂ
You are surprised that the hottest year on record in Sacramento was more than a century ago! You decide that you need to compute a moving average to observe the long-term trend in the data.
Start a new program temp_list.py from your working version of read_temp_file.py. Comment out the line that printsout the year and temperature for each year in the file, and instead add the floating point temperatures one at a time to a growing Python list inside the for loop. Test your code by printing the list of the loop that reads the file.
Below is an example of how your programs output should look:
Temperature anomaly filename:SacramentoTemps.csv [-1.56, -0.08, -0.3, -1.44, ..., -0.06, -0.4, 0.48, 2.63, 0.18]
Submit the completed program to Gradescope as temp_list.py
This is SacramentoTemps.csv
| Year | Value |
| 1880 | -1.56 |
| 1881 | -0.08 |
| 1882 | -0.3 |
| 1883 | -1.44 |
| 1884 | -2.29 |
| 1885 | -1.95 |
| 1886 | -0.63 |
| 1887 | 0.63 |
| 1888 | -0.72 |
| 1889 | 2.99 |
| 1890 | -0.5 |
| 1891 | -1.36 |
| 1892 | 1.03 |
| 1893 | -0.16 |
| 1894 | -0.01 |
| 1895 | -1.46 |
| 1896 | -1.23 |
| 1897 | -0.83 |
| 1898 | -0.91 |
| 1899 | 1.53 |
| 1900 | 1.08 |
| 1901 | 0.24 |
| 1902 | -1.08 |
| 1903 | -1.1 |
| 1904 | -0.83 |
| 1905 | -0.31 |
| 1906 | -0.22 |
| 1907 | -1.02 |
| 1908 | -1.05 |
| 1909 | -0.65 |
| 1910 | -0.65 |
| 1911 | -1.06 |
| 1912 | -0.65 |
| 1913 | -2.32 |
| 1914 | 1.12 |
| 1915 | -0.21 |
| 1916 | -0.57 |
| 1917 | 0.41 |
| 1918 | -0.13 |
| 1919 | 0.48 |
| 1920 | 0.67 |
| 1921 | 0.21 |
| 1922 | 0.65 |
| 1923 | -0.6 |
| 1924 | -1 |
| 1925 | -1.22 |
| 1926 | -1.1 |
| 1927 | -0.03 |
| 1928 | 0.61 |
| 1929 | 0.54 |
| 1930 | 0.66 |
| 1931 | -1.57 |
| 1932 | 0.15 |
| 1933 | 0.83 |
| 1934 | -0.35 |
| 1935 | 0.23 |
| 1936 | -0.66 |
| 1937 | 0.17 |
| 1938 | 0.56 |
| 1939 | 0.31 |
| 1940 | 0.09 |
| 1941 | -0.6 |
| 1942 | -0.51 |
| 1943 | -0.86 |
| 1944 | -0.09 |
| 1945 | -1.19 |
| 1946 | 0.77 |
| 1947 | -0.72 |
| 1948 | -0.33 |
| 1949 | -0.53 |
| 1950 | 0.08 |
| 1951 | 0.73 |
| 1952 | -0.31 |
| 1953 | 0.26 |
| 1954 | -1.9 |
| 1955 | -0.72 |
| 1956 | -0.95 |
| 1957 | -1.12 |
| 1958 | 1.28 |
| 1959 | 1.29 |
| 1960 | 0.28 |
| 1961 | 2.33 |
| 1962 | 0.32 |
| 1963 | -0.25 |
| 1964 | -0.13 |
| 1965 | -0.8 |
| 1966 | 0.1 |
| 1967 | 1.23 |
| 1968 | -0.06 |
| 1969 | -1.19 |
| 1970 | -1.51 |
| 1971 | 0.28 |
| 1972 | -0.15 |
| 1973 | 1.32 |
| 1974 | -0.72 |
| 1975 | 0.49 |
| 1976 | -1.43 |
| 1977 | -1.51 |
| 1978 | 1.61 |
| 1979 | -0.74 |
| 1980 | -1.41 |
| 1981 | -0.09 |
| 1982 | -0.33 |
| 1983 | -0.88 |
| 1984 | -0.06 |
| 1985 | 0.57 |
| 1986 | -0.83 |
| 1987 | -0.77 |
| 1988 | -0.21 |
| 1989 | -0.13 |
| 1990 | -0.54 |
| 1991 | -0.1 |
| 1992 | -0.21 |
| 1993 | -1.8 |
| 1994 | 1.47 |
| 1995 | -0.08 |
| 1996 | -1.28 |
| 1997 | 2.2 |
| 1998 | 0.49 |
| 1999 | -0.37 |
| 2000 | 0.73 |
| 2001 | 0.4 |
| 2002 | 0.15 |
| 2003 | -1.25 |
| 2004 | 0.03 |
| 2005 | 1.47 |
| 2006 | -0.39 |
| 2007 | 0.4 |
| 2008 | 0.59 |
| 2009 | 0.41 |
| 2010 | 0.34 |
| 2011 | -0.22 |
| 2012 | 1.03 |
| 2013 | 0.23 |
| 2014 | -0.06 |
| 2015 | -0.4 |
| 2016 | 0.48 |
| 2017 | 2.63 |
| 2018 | 0.18 |
Step by Step Solution
There are 3 Steps involved in it
This is SacramentoTempscsv Year Value 1880 156 1881 008 1882 03 1883 144 1884 229 1885 195 1886 063 1887 063 1888 072 1889 299 1890 05 1891 136 1892 1... View full answer
Get step-by-step solutions from verified subject matter experts
