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

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section: Chapter Questions
Problem 6PP: (Data processing) Write a C++ program that reads the file created in Exercise 4 one record at a...
icon
Related questions
Question

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

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
List
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr