Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python Q1) List and Tuples Exercise Make a .py file called fruitStorage.py. The script should ask users for a fruit/vegetable and the count of those
Python
Q1) List and Tuples Exercise Make a .py file called fruitStorage.py. The script should ask users for a fruit/vegetable and the count of those items that they have, or "quit" to quit. Until the user enters quit, store the fruit and their count in a list of tuples, of the form: [(tomato, 5), (blueberry, 10), ....] Duplicates should add the count to the already stored count. When the user enters quit, print a report of the user's input, with the following general appearance: Produce, Count tomato, 5 blueberry, 10 Average count per produce item: # Total # of produce: # Where total is the sum of counts and the average is the average count of produce per produce. Q2) Dictionary Exercise 1 Make an edit of the first .py, called fruitDictionary. Perform the same task as above, with the same output. The exact approach is up to you. In a comment in the .py file, say which of the two approaches you prefer and why. Q3) Files and Lists Download romeo.txt and make a py script called romeoStorage.py. The script should open the file romeo.txt and read it line by line. For each line, split the line into a list of words using the split function. As you read words from the file, keep both a list and a dictionary of the unique words. The dictionary should keep a count of the unique worlds as the value, while the word should be the key. When the program completes, sort and print the resulting words in alphabetical orderStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started