Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. All work must be done in Replit - Final Exam project. As you work, an audit trail is being maintained to check for

 6. Once the user has provided valid inputs, then save the values to a text file. - If this file already exists, new data shou 

1. All work must be done in Replit - Final Exam project. As you work, an audit trail is being maintained to check for potential cheating. To avoid problems, do ALL WORK in the Final Exam replit. Due to time constraint, this exam will be especially difficult for most students. You are not expected to to get everything perfect, but you should be able to do most of the work. You will get partial credit. I also curve my exams. I will not know the curve until all the grading is finished for the entire semester. . I will post your grades on CUNY first by December 23 2. Use import statements as needed to make this application work. (2 points) 3. For file handling, use Open and Close statements as appropriate. (2 points) 4. You will ask the user to enter the following data: . id: Any string is valid. Remove any leading or trailing spaces before assigning the value to the variable. In other words, all the work must be done in one line. (2 points) price: Any decimal or integer number. Any conversion should be done before assigning the variable a value. In other words, all the work must be done in one line. (2 points) color: This is a string input. You must convert it to UPPER CASE using Python's built-in functions before assigning it to the variable. Also, remove any leading or trailing spaces before assigning the value to the variable. In other words, all the work must be done in one line. (3 points) If the user does not enter a valid value for id, the program should immediately exit and give an error message. (2 points) If the user does not enter a valid value for color, the program should immediately exit and give an error message. (2 points) 5. Create a variable for internal use by your program. (1 points) Create a variable called FILENAME. Keep it in uppercase as shown. Assign this variable the value: item-data.txt The user of your application should not be able to 6. Once the user has provided valid inputs, then save the values to a text file. If this file already exists, new data should be added to it at the end. If this files does not exist, it should be automatically created. (3 points) The file name should reference the FILENAME variable created earlier (3 points) You will ensure that each inventory item is in its own line. No two inventory items should be on the same linc (3 points) 7. After the data has been saved to the file, display an appropriate message to the user. (1 points) 8. Print a message saying: Retrieving Existing Data (1 points) 9. Read the data from the previously created file. Using a loop, read and display the entire contents of the file ONE LINE AT A TIME. (5 points) 10. Add some dummy data. (3 points)

Step by Step Solution

3.43 Rating (162 Votes )

There are 3 Steps involved in it

Step: 1

To accomplish these tasks you can use Pythons builtin input function to get user input and the tryex... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

University Physics with Modern Physics

Authors: Hugh D. Young, Roger A. Freedman

14th edition

133969290, 321973615, 9780321973610, 978-0133977981

More Books

Students also viewed these Accounting questions