ry Bookmarks People Window Help group act2alis x Homework x

ry Bookmarks People Window Help group act2a-lis x Homework x y l Mat group act2b-lis x uaccess/lessonbuilder/item/11777871/group/e3dbb580-16f5-490f-affo-88f96032a87o/Weekly9%20 CSC 110 Group Class Activity #2b Date: Group suppose you have been hired by Big Money, Inc, a stock advising company, to do some Python programming for them. You are given some data in the form of the following lists: stocks IBM AAPL \'GooG\', \'FB\', SMSN INTC McD\' TWTR stock Prices 23. 4, 24.5, 25.3, 56.7, 89.4, 45.3, 43.6, 67.4) The first list stores the names of stocks that your company is interested in trading The second list is the prices of the stocks. Note that these lists are related in that the first item in the stockPrices list is the price associated with the first item in the stocks list. 1) Given this data, what is the price of Google stock (stock symbol GooG)?

Solution

1. Price of GOOGLE stock is 25.3

2. stocks[3] gives \"FB\" as output

SMSN will be next output since stockPrices[3] > stockPrices[4] is False statement.

The next output will be as follows:

[\'IBM\', \'AAPL\', \'GOOG\', \'FB\', \'SMSN\', \'INTC\', \'MCD\', \'TWTR\', \'MSO\']

The next output will be as follows:

[\'FB\', \'SMSN\', \'INTC\', \'MCD\', \'TWTR\']

3. The following code asks name of the stock and prints its corresponding stock price.

name_of_stock = input(\"Enter the name of the stock: \")
print(stockPrices[stocks.index(name_of_stock)])

output:

Enter the name of the stock: GOOG
25.3

4. Linear search algorithm is used in index function implemented in python.

 ry Bookmarks People Window Help group act2a-lis x Homework x y l Mat group act2b-lis x uaccess/lessonbuilder/item/11777871/group/e3dbb580-16f5-490f-affo-88f960

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site