Using python, write code for problem. The text file DOW.txt is used in this prob
ID: 3846614 • Letter: U
Question
Using python, write code for problem. The text file DOW.txt is used in this problem and i have put screenshot of contents of the file. Please also put screenshot of your code.
In Exercises 7 through 10, use the file Dow .txt that contains the name, symbol, exchange, industry, price at the end of trading on 12/31/2012, price at the end of trading on 12/31/2013, 2013 earnings per share, and the dividend paid in 2013 for each of the 30 stocks in the Dow Jones Industrial Average. The first three lines of the file are American Express, AXP,NYSE ,Consumer finance,57.48,90.73,4. 88, 89 Boeing ,BA,NYSE,Aerospace & Defense, 75.36,136.49,5.96,2.19 Caterpillar,CAT,NYSE Construction & Mining Equipment, 89. 61,90.81, 5.75,2.32 7. DOW Write a program that displays the symbols for the 30 DOW stocks in alpha- betical order. When the user enters one of the symbols, the information shown in Fig. 5.13 should be displayed. The Price/Earnings ratio should be calculated as the price of a share of stock on 12/31/2013 divided by the 2013 earnings per share.Explanation / Answer
Python Code for the problem is like :
print ("Symbols of the thirty DOW Stocks")
dict = {'Name':'American Express','Symbol':'AXP','Exchange':'NYSE','Industry':'Consumer finance','PriceEnd':'57.48','PriceEndo':'90.73','EarningShare':'4.88','Dividend':'0.89'}
print (dict['Symbol'])
dict1 = {'Name':'Boeing','Symbol':'BA','Exchange':'NYSE','Industry':'Aerospace & Defence','PriceEnd':'75.36','PriceEndo':'136.49','EarningShare':'5.96','Dividend':'2.19'}
print (dict1['Symbol'])
dict2 = {'Name':'Caterpillar','Symbol':'CAT','Exchange':'NYSE','Industry':'Construction @ Mining Equipment','PriceEnd':'89.61','PriceEndo':'90.81','EarningShare':'5.75','Dividend':'2.32'}
print (dict2['Symbol'])
dict3 = {'Name':'Cisco System','Symbol':'CSCQ','Exchange':'NASDAQ','Industry':'Computer Networking','PriceEnd':'19.65','PriceEndo':'22.43','EarningShare':'1.49','Dividend':'0.72'}
print (dict3['Symbol'])
dict4 = {'Name':'Chevron Corporation','Symbol':'CVX','Exchange':'NYSE','Industry':'Oil & Gas','PriceEnd':'108.14','PriceEndo':'124.91','EarningShare':'11.09','Dividend':'4'}
print (dict4['Symbol'])
dict5 = {'Name':'DuPont','Symbol':'DD','Exchange':'NYSE','Industry':'Chemical Industry','PriceEnd':'44.98','PriceEndo':'64.97','EarningShare':'5.18','Dividend':'1.8'}
print (dict5['Symbol'])
dict6 = {'Name':'Walt Disney','Symbol':'DIS','Exchange':'NYSE','Industry':'Broadcasting & Entertainment','PriceEnd':'49.74','PriceEndo':'76.4','EarningShare':'3.38','Dividend':'0.75'}
print (dict6['Symbol'])
dict7 = {'Name':'General electric','Symbol':'GE','Exchange':'NYSE','Industry':'Conglomereate','PriceEnd':'20.99','PriceEndo':'28.03','EarningShare':'1.27','Dividend':'0.79'}
print (dict7['Symbol'])
dict8 = {'Name':'Goldman Sachs','Symbol':'GS','Exchange':'NYSE','Industry':'Banking','PriceEnd':'176.96','PriceEndo':'177.26','EarningShare':'15.96','Dividend':'2.05'}
print (dict8['Symbol'])
dict9 = {'Name':'The Home Depot','Symbol':'HD','Exchange':'NYSE','Industry':'Home Improvement retailer','PriceEnd':'61.85','PriceEndo':'61.85','EarningShare':'3.76','Dividend':'1.64'}
print (dict9['Symbol'])
dict10 = {'Name':'International Buisness Machine','Symbol':'IBM','Exchange':'NYSE','Industry':'Computers & Technology','PriceEnd':'191.55','PriceEndo':'187.57','EarningShare':'14.34','Dividend':'3.8'}
print (dict10['Symbol'])
dict11 = {'Name':'Intel','Symbol':'INTC','Exchange':'NASDAQ','Industry':'Semiconductors','PriceEnd':'20.62','PriceEndo':'25.95','EarningShare':'1.89','Dividend':'0.9'}
print (dict11['Symbol'])
dict12 = {'Name':'Jhonson & Jhonson','Symbol':'JNJ','Exchange':'NYSE','Industry':'Pharmaceuticals','PriceEnd':'70.1','PriceEndo':'91.59','EarningShare':'4.81','Dividend':'2.59'}
print (dict12['Symbol'])
dict13 = {'Name':'JPMorgan Chase','Symbol':'JPM','Exchange':'NYSE','Industry':'Banking','PriceEnd':'43.97','PriceEndo':'58.48','EarningShare':'4.35','Dividend':'1.44'}
print (dict13['Symbol'])
dict14 = {'Name':'Coca-Cola','Symbol':'KO','Exchange':'NYSE','Industry':'Beverages','PriceEnd':'36.25','PriceEndo':'41.31','EarningShare':'1.9','Dividend':'1.12'}
print (dict14['Symbol'])
dict15 = {'Name':'McDonalds','Symbol':'MCD','Exchange':'NYSE','Industry':'Fast Food','PriceEnd':'88.21','PriceEndo':'97.03','EarningShare':'5.55','Dividend':'3.12'}
print (dict15['Symbol'])
dict16 = {'Name':'3M','Symbol':'MMM','Exchange':'NYSE','Industry':'Congolemerate','PriceEnd':'92.85','PriceEndo':'140.25','EarningShare':'6.72','Dividend':'2.76'}
print (dict16['Symbol'])
dict17 = {'Name':'Merck','Symbol':'MRK','Exchange':'NYSE','Industry':'Pharmaceuticals','PriceEnd':'40.94','PriceEndo':'50.05','EarningShare':'1.47','Dividend':'1.73'}
print (dict17['Symbol'])
dict18 = {'Name':'Microsoft','Symbol':'MSFT','Exchange':'NASDAQ','Industry':'Software','PriceEnd':'26.71','PriceEndo':'37.41','EarningShare':'2.63','Dividend':'1.07'}
print (dict18['Symbol'])
dict19 = {'Name':'Nike','Symbol':'NKE','Exchange':'NYSE','Industry':'Consumer Goods','PriceEnd':'78.7','PriceEndo':'78.64','EarningShare':'2.97','Dividend':'0.93'}
print (dict19['Symbol'])
dict20 = {'Name':'Pfizer','Symbol':'PFE','Exchange':'NYSE','Industry':'Pharmaceuticals','PriceEnd':'25.08','PriceEndo':'30.63','EarningShare':'3.19','Dividend':'0.98'}
print (dict20['Symbol'])
dict21 = {'Name':'Procter & Gamble','Symbol':'PG','Exchange':'NYSE','Industry':'Consumer goods','PriceEnd':'67.89','PriceEndo':'81.41','EarningShare':'4.01','Dividend':'2.49'}
print (dict21['Symbol'])
dict22 = {'Name':'AT&T','Symbol':'T','Exchange':'NYSE','Industry':'Telecommunication','PriceEnd':'33.71','PriceEndo':'35.16','EarningShare':'3.39','Dividend':'1.81'}
print (dict22['Symbol'])
dict23 = {'Name':'Travelers','Symbol':'TRV','Exchange':'NYSE','Industry':'Insurance','PriceEnd':'71.82','PriceEndo':'90.54','EarningShare':'9.74','Dividend':'1.96'}
print (dict23['Symbol'])
dict24 = {'Name':'United Health Group','Symbol':'UNH','Exchange':'NYSE','Industry':'Managed Health Care','PriceEnd':'54.24','PriceEndo':'75.3','EarningShare':'5.5','Dividend':'1.052'}
print (dict24['Symbol'])
dict25 = {'Name':'United Technologies Corp.','Symbol':'UYX','Exchange':'NYSE','Industry':'Conglomerate','PriceEnd':'82.01','PriceEndo':'113.8','EarningShare':'6.25','Dividend':'2.25'}
print (dict25['Symbol'])
dict27 = {'Name':'Visa','Symbol':'V','Exchange':'NYSE','Industry':'Consumer Finance','PriceEnd':'222','PriceEndo':'222.68','EarningShare':'7.59','Dividend':'1.39'}
print (dict27['Symbol'])
dict26 = {'Name':'Verizon','Symbol':'VZ','Exchange':'NYSE','Industry':'Telecommunication','PriceEnd':'43.27','PriceEndo':'49.14','EarningShare':'4','Dividend':'2.06'}
print (dict26['Symbol'])
dict28 = {'Name':'WalMart','Symbol':'WMT','Exchange':'NYSE','Industry':'Retail','PriceEnd':'68.23','PriceEndo':'78.69','EarningShare':'4.88','Dividend':'0.47'}
print (dict28['Symbol'])
dict29 = {'Name':'ExxonMobil','Symbol':'XOM','Exchange':'NYSE','Industry':'Oil & Gas','PriceEnd':'86.55','PriceEndo':'101.2','EarningShare':'7.37','Dividend':'2.52'}
print (dict29['Symbol'])
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.