COP1000 P-4 Create a program that reads data from a file and writes data to the file.... Use a list to store the data read from the file.... The data that you will have is a grocery list. Store data...

1 answer below »
Create a program that reads data from a file and writes data to the file.... Use a list to store the data read from the file.... The data that you will have is a grocery list. Store data read from file in a list. The user should be able to see the list and add to it.


COP1000 P-4 Create a program that reads data from a file and writes data to the file.... Use a list to store the data read from the file.... The data that you will have is a grocery list. Store data read from file in a list. The user should be able to see the list and add to it. This is where repl.it comes in very handy. Your .txt file will be in repl.it and I will get it when you submit the link like you have done previously. (here is an awesome link from repl.it)and (another ) Learning Outcomes Measured COP1000 CLO-2 Develop and implement algorithms that use conditional, compound decisions, looping, nested loops, and case statements. COP1000 CLO-4 Design recursive algorithms. COP1000 CLO-5 Develop algorithms that use one and two dimensional arrays. https://repl.it/@ianperkins/CSV-read-lines-from-file-and-create-list https://repl.it/@ianperkins/CSV-read-lines-from-file-and-create-list https://repl.it/@MrSS1/Open-a-Text-File
Answered Same DayOct 22, 2021

Answer To: COP1000 P-4 Create a program that reads data from a file and writes data to the file.... Use a list...

Suraj answered on Oct 23 2021
115 Votes
Python Function
def grocery_items(x):
groc=[]
file=open("grocery.txt","w+")
n=int(i
nput("Enter total number of items"))
for i in range(0,n):
ls=input("Enter the elements: ").split()[:n]
for i in range(len(ls)):
file.write(ls[i])
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here