IN PYTHON: Write a program where the user enters a name. Using the read function, check to see if the name is in the text document. If it is, respond back to the user the name is found within the list
My code and output
Here is the names.txt file
Code fot copying
n=str(input("Enter name: "))
f=open('names.txt')
if n in f.read():
print(True)
else:
print(False)
code snippet
n=str(input("Enter name: "))
f=open('names.txt')
if n in f.read():
print(True)
else:
print(False)
Get Answers For Free
Most questions answered within 1 hours.