Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 1 : Write a Python file called p 1 . py that prints a menu that either displays the number of unique sectors in
Part :
Write a Python file called
ppy that prints a menu that either displays the number of unique
sectors in the database or exits execution.
You are provided a text file that is space delimited, called companyList.txt If the user indicates
that he would like to know the number of sectors your program should read the file then you will
read the file line by line.
Your program will accomplish the following:
Read in the file companyList.txt and store the information.
a You can do this by creating two lists.
Determine the number of unique sectors You must use a set for this part.
The user is prompted as to whether they would like a readout of the sectors or to
terminate execution.
a Display the total number of sectors and companies and a list of the sectors along
with the number of companies in each sector.
Your output should appear similar to:
Welcome to the Generic Finance App!
Enter to see how many sectors there are.
Enter any other input to quit
There are sectors companies
: FMCG
: Conglomerate
: Defense
: Auto
: Finance
: Retail
: Software
: oil
: Semiconductor
Press enter to continue...
Enter to see how many sectors there are.
Enter any other input to quit
It is Ok if the sectors are listed in a different order than shown above.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started