Skip to content

Instantly share code, notes, and snippets.

View Lukasz-Obiedzinski's full-sized avatar

Łukasz Obiedziński Lukasz-Obiedzinski

View GitHub Profile
#Read in the contents of the file SP500.txt which has monthly data for 2016 and 2017
#about the S&P 500 closing prices as well as some other financial indicators,
#including the “Long Term Interest Rate”, which is interest rate paid on 10-year U.S. government bonds.
#Write a program that computes the average closing price (the second column, labeled SP500)
#and the highest long-term interest rate. Both should be computed only for the period from June 2016 through May 2017.
#Save the results in the variables mean_SP and max_interest
with open("SP500.txt", "r") as file:
new = file.readlines()
closing_price = []