PYTHON PROGRAMMING LANGUAGE Create a new text document called names.txt (this is done by hand - not using programming) with the following names: Adam, Bryan, Charlie. Each name should be followed by a hard return (do not store them in a list). Main Function. 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. Read Function. The read function should return the contents of the text document as a list. Write Function. The write function should take the list and override the file with the new names list in reverse alphabetical order with a hard return after each name. EXAMPLE Please enter a name: Adam Adam is found in the list. Enter another name (Y/N): Y Please enter a name: Andrew Sorry, Andrew was not found in the list. Would you like to add it? (Y/N): Y Andrew has been added to the list. Enter another name (Y/N): N LIST EXAMPLE adam bryan charlie Final List charlie bryan andrew adam
PYTHON
Create a new text document called names.txt (this is done by hand - not using programming) with the following names: Adam, Bryan, Charlie. Each name should be followed by a hard return (do not store them in a list).
Main Function. 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.
Read Function. The read function should return the contents of the text document as a list.
Write Function. The write function should take the list and override the file with the new names list in reverse alphabetical order with a hard return after each name.
EXAMPLE
Please enter a name: Adam
Adam is found in the list.
Enter another name (Y/N): Y
Please enter a name: Andrew
Sorry, Andrew was not found in the list. Would you like to add it? (Y/N): Y
Andrew has been added to the list.
Enter another name (Y/N): N
LIST EXAMPLE
adam
bryan
charlie
Final List
charlie
bryan
andrew
adam

Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images









