#Create a solution that accepts
#an integer input identifying how many different shares
#of stock are purchased from the Old Town Stock Exchange, followed by an equivalent number of string inputs representing the stock selections.
#The following dictionary, stock, lists available stock selections as the key and the cost per selection as the value.
stocks = {'TSLA': 912.86 , 'BBBY': 24.84, 'AAPL': 174.26, 'SOFI': 6.92, 'KIRK': 8.72, 'AURA': 22.12, 'AMZN': 141.28, 'EMBK': 12.29, 'LVLU': 2.33}
Output the total cost of the purchased shares of stock to two decimal places.
stocks = {'TSLA': 912.86, 'BBBY': 24.84, 'AAPL': 174.26, 'SOFI': 6.92, 'KIRK': 8.72, 'AURA': 22.12, 'AMZN': 141.28, 'EMBK': 12.29, 'LVLU': 2.33}
#solution accepts an integer input representing the number of stock selections
print("Enter a quantity of stocks followed by stock symbol(s):")
num_of_stocks = int(input())
total_cost = 0.0
count = 0
#solution accepts string inputs equivalent to the integer input identifying the stock selections
while count < num_of_stocks:
stock_name = input()
total_cost += stocks[stock_name]
count += 1
#solution outputs the total cost of stock as "Total price: $" followed by the total cost to 2 decimal places
print(f"Total price: ${total_cost:.2f}")
To embed this project on your website, copy the following code and paste it into your website's HTML: