I function to display computer pioneers name def DisplayNames (name Dict) print \nComputer Pioneers name list: ') for name in nameDict print (name) main method def main () open ( Pioneers.txt'); inputFile nameDict = ) ; singleLine while singleLine: splittedLine inputFile.readline singleLine.split(','); nameDict [splittedLine [0]] = splittedLine [1]; = inputFile.readline ) singleLine inputName = while (True) DisplayNames (nameDict); = input ('\nEnter a name from the above 1list (Enter Quit to exit) '); inputName def close (inputName) if inputName.upper () "QUIT": exit from the program after the result print ("Thank you. ") quit elif inputName in nameDict.keys ) print (inputName ',' nameDict [inputName]); #otherwise name doesn't exist. Ask user to try again else: print 'Entered name is not found in the list. Please try again with different name.'); main (

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Python 3.7.4:

I have project named “MOREPioneers.py “.  I need to take a text file named Pioneers.txt that has a list of computer influencers and their accomplishments separated by a comma and display them when the user requests.  It SHOULD be able to accept mixed cases for the name, loop as many times as the user wants, and end when the user says “Quit,” without using “break;” my instructor says that using “break” is a bad practice.  I seem to be failing on all accounts, ha.  Would you mind reviewing my code and telling me how I can correct it, please?

The code is below for you to copy and paste, I've also attached a picture in case the indentation gets lost:

''' function to display computer pioneers name '''
def DisplayNames(nameDict):
    print('\nComputer Pioneers name list: ');
    for name in nameDict:
        print(name);

''' main method '''
def main():
    inputFile = open('Pioneers.txt');
    nameDict = {};

    singleLine = inputFile.readline();
    while singleLine:
        splittedLine = singleLine.split(',');
        nameDict[splittedLine[0]] = splittedLine[1];
        singleLine = inputFile.readline();
    inputName = '';

    while(True):
        DisplayNames(nameDict);
        inputName = input('\nEnter a name from the above list (Enter Quit to exit): ');

def close(inputName):  # exit from the program after the result
    if inputName.upper() = "QUIT":
        print("Thank you.")
        quit()
    elif inputName in nameDict.keys():
        print(inputName + ',' + nameDict[inputName]);
# otherwise name doesn't exist. Ask user to try again.
    else:
        print('Entered name is not found in the list. Please try again with different name.');
        
main()

I function to display computer pioneers name
def DisplayNames (name Dict)
print \nComputer Pioneers name list: ')
for name in nameDict
print (name)
main method
def main ()
open ( Pioneers.txt');
inputFile
nameDict = ) ;
singleLine
while singleLine:
splittedLine
inputFile.readline
singleLine.split(',');
nameDict [splittedLine [0]] = splittedLine [1];
= inputFile.readline )
singleLine
inputName =
while (True)
DisplayNames (nameDict);
= input ('\nEnter a name from the above 1list (Enter Quit to exit) ');
inputName
def close (inputName)
if inputName.upper () "QUIT":
exit from the program after the result
print ("Thank you. ")
quit
elif inputName in nameDict.keys )
print (inputName ',' nameDict [inputName]);
#otherwise name doesn't exist. Ask user to try again
else:
print 'Entered name is not found in the list. Please try again with different name.');
main (
Transcribed Image Text:I function to display computer pioneers name def DisplayNames (name Dict) print \nComputer Pioneers name list: ') for name in nameDict print (name) main method def main () open ( Pioneers.txt'); inputFile nameDict = ) ; singleLine while singleLine: splittedLine inputFile.readline singleLine.split(','); nameDict [splittedLine [0]] = splittedLine [1]; = inputFile.readline ) singleLine inputName = while (True) DisplayNames (nameDict); = input ('\nEnter a name from the above 1list (Enter Quit to exit) '); inputName def close (inputName) if inputName.upper () "QUIT": exit from the program after the result print ("Thank you. ") quit elif inputName in nameDict.keys ) print (inputName ',' nameDict [inputName]); #otherwise name doesn't exist. Ask user to try again else: print 'Entered name is not found in the list. Please try again with different name.'); main (
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
InputStream
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education