Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use try and except method to solve the problem es New Roman 13 1 Normal 1 No Spac. Heading 1 Editing Dic Font Styles

Please use try and except method to solve the problem image text in transcribed
image text in transcribed
es New Roman 13 1 Normal 1 No Spac. Heading 1 Editing Dic Font Styles 3. Write a function tickerO that takes a string representing the name of a file as a parameter. The file contains company names and stock (ticker) symbols. In the file, the company name appears on one line and the stock symbol for that company appears on the following line. Both the company name and the stock symbol appear in all caps. For example, see the file nasdaq.txt in the zip file containing the assignment template. The ticker() function reads the file and stores the company names and stock symbols in a dictionary. It then provides an interface to the user so that he/she can obtain the stock symbol for a given company. The user should be able to provide the name of the company in lowercase, uppercase, or mixed case and get the stock symbol associated with the company found in the file the function processed. When the user enters a blank company name, the program should stop. If the file provided as a parameter cannot be opened, the function should display an appropriate message and stop. Test your program on the nasdaq.txt file provided with the assignment template. Some sample interactions are provided below: >ticker(nasdaq.txt') Enter Company name: facebook FACEBOOK is not in the ticker system Enter Company name: eBay Ticker symbol: EBAY Enter Company name: ank you for using the ticker system. >>>ticker(noFile.txt') noFile.txt could not be opened. Exiting. . words 3. Write a function ticker) that takes a string representing the name of a file as a parameter. The file contains company names and stock (ticker) symbols. In the file, the company name appears on one line and the stock symbol for that company appears on the following line. Both the company name and the stock symbol appear in all caps. For example, see the file nasdaq.txt in the zip file containing the assignment template. The ticker) function reads the file and stores the company names and stock symbols in a dictionary. It then provides an interface to the user so that he/she can obtain the stock symbol for a given company. The user should be able to provide the name of the company in lowercase, uppercase, or mixed case and get the stock symbol associated with the company found in the file the function processed. When the user enters a blank company name, the program should stop. If the file provided as a parameter cannot be opened, the function should display an appropriate message and stop. Test your program on the nasdaq.txt file provided with the assignment template. Some sample interactions are provided below: >>ticker(nasdaq.txt') Enter Company name: facebook FACEBOOK is not in the ticker'system. Enter Company name: eBay Ticker symbol: EBAY Enter Company name: 7 ank you for using the ticker system. >>>ticker(noFile.txt') noFile.txt could not be opened. Exiting

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

More Books

Students also viewed these Databases questions

Question

How do books become world of wonder?

Answered: 1 week ago