write using python idle 2.7 or higher very new to this subject be very descripti
ID: 3790271 • Letter: W
Question
write using python idle 2.7 or higher very new to this subject be very descriptive
Eile Edit Yew Hbtory Bookmarks bols Help x Las Vegas odds Sports Sc x Free Daily Sports Picks fro. x SakaieURI: cso 110spri. x e sts-f x uriedu/access/lessonbuilderitem/11693721/group/e3dbb580-16f5-490f-aft0-88196032a87c/Labs/Lab 3 Using Lists 9 23 /lab3-lists-f 16.pdf https sakai. 2 of 3 Instructor Initials: PART 2: MULTIPLE LISTS (5 points) Now you are working for a finance company and you have data in form of two lists, one is a list of stock names, the other is a list of the prices ofthose stocks. You can start with the following data: stocks ('IBM', AAPL 'GOOG', 'FB', SMSN INTC MCD TWTR. stock Prices 23.4,24.5, 25.3, 56.7, B9. 4, 45.3, 43.6, 67. 4 Suppose the value of a particular stock has increased by a certain percentage. Write a program that does the following: 1) Ask the user to enter the name of the stock 2) Ask the user to enter the percentage increase 3) Find the price of the stock 4) Compute the new value with the requested increase 5) Update the stock price 6) Print the updated stock list Note: For the purposes of this assignmen assume that you cannot use the dex function provided by Python. Instructor Initials:Explanation / Answer
stocks=['IBM','AAPL','GOOG','FB','SMSN','INTC','MCD','TWTR']
stockPrices=[23.4,24.5,25.3,56.7,89.4,45.3,43.6,67.4]
stockname=raw_input("Enter stock name")
index=stocks.index(stockname)
print "Price of stock is ",stockPrices[index]
per_increa=input("Enter increase percentage")
stockPrices[index]=stockPrices[index]+stockPrices[index]*per_increa/100
print "Updated stock list "
print stockPrices
===============================================================
OUTPUT:
akshay@akshay-Inspiron-3537:~/Chegg$ python stock.py
Enter stock nameFB
Price of stock is 56.7
Enter increase percentage2
Updated stock list
[23.4, 24.5, 25.3, 57.834, 89.4, 45.3, 43.6, 67.4]
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.