Python 3.7.4:The file Pioneers.txt contains some computer pioneers and their accomplishments.  The first three records in the file are:Charles Babbage, is called the father of the computer.Augusta Ada Byron, was the first computer programmerAlan Turing, was a prominent  computer science theorist.Write a program that displays the names.  When a name is entered as input, the person's accomplishment should be displayed.I can get the names to come up, but I keep messing up the accomplishments.  Would you mind describing how you did it step-by-step, please, so that I may learn?  Thank you!

Question
Asked Nov 19, 2019
152 views

Python 3.7.4:

The file Pioneers.txt contains some computer pioneers and their accomplishments.  The first three records in the file are:

Charles Babbage, is called the father of the computer.
Augusta Ada Byron, was the first computer programmer
Alan Turing, was a prominent  computer science theorist.

Write a program that displays the names.  When a name is entered as input, the person's accomplishment should be displayed.

I can get the names to come up, but I keep messing up the accomplishments.  Would you mind describing how you did it step-by-step, please, so that I may learn?  Thank you!

check_circle

Expert Answer

Step 1

Program:

arr = []

try:   

    with open('Pioneers.txt','r') as p:       

        for line in p:           

            arr.append(line.split(','))

       

        name = input('Enter the name of a computer pioneer: ')

 

        x = ''

        for i in arr:

            if name == i[0]:

                x = ' '.join(i)

                break

        print(x)

 

except FileNotFoundError as e:

    print('ERROR - FILE NOT FOUND')

 

Input file: “Pioneers.txt”

Charles Babbage, is called the father of the computer.

Augusta Ada Byron, was the first computer programmer

Alan Turing, was a prominent  computer science theorist.

Screenshot of the program:

 

arr
try:
with open('Pioneers.txtr')
for line in p:
arr.append (line . split (',' ))
name = input('Enter the name of a computer
pioneer: '
X =
for i in arr:
ie]
join(i)
if name
х 3
break
print(x)
except FileNot Found Error as e
FILE NOT FOUND'
print('ERROR
help_outline

Image Transcriptionclose

arr try: with open('Pioneers.txtr') for line in p: arr.append (line . split (',' )) name = input('Enter the name of a computer pioneer: ' X = for i in arr: ie] join(i) if name х 3 break print(x) except FileNot Found Error as e FILE NOT FOUND' print('ERROR

fullscreen
Step 2

Output:

...
Enter the name of a
computer pioneer: Alan Turing
Alan Turing
was a prominent
computer science theorist.
help_outline

Image Transcriptionclose

Enter the name of a computer pioneer: Alan Turing Alan Turing was a prominent computer science theorist.

fullscreen

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: A variable name in the programming language Visual Basic must begin with a letter (uppercase or lowe...

A: Answer:Number of letters (uppercase + lowercase) = 26 + 26 = 52Number of digits (0 to 9) = 10Number ...

question_answer

Q: Most modern TCP implementations use pseudo-random number generators (PRNG) to determine starting seq...

A: The ith number can be generated if (i-1)th number is generated, and thus the entire series can be ge...

question_answer

Q: Create a subclass of Vehicle called Car. Car should have additional attributes of: make (String)mode...

A: Creation of subclass “Car” which is extended from “Vehicle” class:The "Car" subclass contains "make"...

question_answer

Q: 2. (5.12 in 8e) answer each of the followig question. a) what does it mean to choose numbers "at ran...

A:  a) Choosing numbers at random means that any number can be selected and every number has an equal c...

question_answer

Q: A transitive dependency is equivalent to which of the following?A) A functional dependency between t...

A: Transitive dependencyA transitive dependency in a database is an indirect relationship between value...

question_answer

Q: ABC Accounting Company is a company that manages the financials for various small companies on a nat...

A: 1) To prevent remote employees from being hacked, the following steps can be taken:A Virtual private...

question_answer

Q: Active Directory metadata describes the actual Active Directory data, not the Active Directory datab...

A: Active Directory:The Microsoft Technology used to manage computers and the other devices in a networ...

question_answer

Q: java write a app that prompts the user for the number of miles and outputs the conversion to kilomet...

A: Program DescriptionA java JavaX application is written which accepts user input in miles and display...

question_answer

Q: What is a disaster recovery plan, and why is it important for the organization? How to evaluate the ...

A: Disaster recovery plan is a formal documentation that includes detailed instructions and structural ...