Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I use the python language Read in the contents of the file SP500.txt which has monthly data for 2016 and 2017 about the S&P 500

I use the python languageimage text in transcribedimage text in transcribedimage text in transcribed

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. Save & Run Original - 1 of 1 Show CodeLens Write the data in variable artist_songs into a csv file, 'songs.txt' , where the first column is singer name and second column is a song name. Each line should have a singer and a song name. Use "Name" and "Song " as headers. Do not include double quotation marks (") in your CSV but you should include apostrophes where necessary (for example, for the song "We Don't Talk Anymore"). Save & Run Original - 1 of 1 Show CodeLens UW NA 1 artist_songs = { 'Taylor Swift': ['Love Story', 'You need to Calm Down'], 'Charlie Puth': ['Attention', "We Don't Talk Anymore", 'Change'] You will need to write two functions for this problem. The first function, divide that takes in any number and returns that same number divided by 2. The second function called sum should take any number, divide it by 2, and add 6. It should return this new number. You should call the divide function within the sum function. Do not worry about decimals. Save & Run Original - 1 of 1 Show CodeLens 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. Save & Run Original - 1 of 1 Show CodeLens Write the data in variable artist_songs into a csv file, 'songs.txt' , where the first column is singer name and second column is a song name. Each line should have a singer and a song name. Use "Name" and "Song " as headers. Do not include double quotation marks (") in your CSV but you should include apostrophes where necessary (for example, for the song "We Don't Talk Anymore"). Save & Run Original - 1 of 1 Show CodeLens UW NA 1 artist_songs = { 'Taylor Swift': ['Love Story', 'You need to Calm Down'], 'Charlie Puth': ['Attention', "We Don't Talk Anymore", 'Change'] You will need to write two functions for this problem. The first function, divide that takes in any number and returns that same number divided by 2. The second function called sum should take any number, divide it by 2, and add 6. It should return this new number. You should call the divide function within the sum function. Do not worry about decimals. Save & Run Original - 1 of 1 Show CodeLens

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

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions

Question

Define Decision making

Answered: 1 week ago

Question

What are the major social responsibilities of business managers ?

Answered: 1 week ago

Question

What are the skills of management ?

Answered: 1 week ago