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!
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
Output:
...Enter the name of a computer pioneer: Alan Turing Alan Turing was a prominent computer science theorist.
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 ...
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...
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"...
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...
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...
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...
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...
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...
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 ...