Create an PDF or NOTEPAD file that states the purpose in your own words, specify
ID: 3597095 • Letter: C
Question
Create an PDF or NOTEPAD file that states the purpose in your own words, specify input that is needed, expected output, and the step by step process that will obtain the output from the input (the algorithm) for each or the problems below. Also specify test data that can be used to all the scenarios described for each problem. Carefully read the requirements of each. No actual Python code should be used, just pseudo-code.
Problem: Write a process (do not create a program) that will allow the user to enter the values for 2 lists that are in parallel. The first list will contain the names of 5 salsas: mild, medium, sweet, hot, and zesty. The second list will contain the number of jars that were sold of each type of salsa. Because the lists are in parallel items in the lists with the same index or subscribe refer to the same salsa. For example name[1] and sales[1] would refer to the same salsa. Determine the name of the salsa which had the highest sales and the name of the salsa which had the lowest sales without using any of the built-in functions for lists.
Explanation / Answer
FindHighestAndLowestSellingSalsa()
salsaNames = []
salsaSales = []
for i from 1 to 5
salsa = prompt user for salsa
sales = prompt user for sales
salsaNames [i] = salsa
salsaSales [i] = sales
(highIndex, lowIndex) = getHighLowSalesIndex(salsaSales)
print high selling salsa is salsaNames[highIndex]
print low selling salsa is salsaNames[lowIndex]
getHighLowSalesIndex(salsaSales):
low = salsaSales[0]
lowIndex = 0
high = salsaSales[0]
highIndex = 0
for i = 1 to salsaSalessize:
if low > salsaSales[i]
low = salsaSales[i]
lowIndex = i
if high < salsaSales[i]
high = salsaSales[i]
highIndex = i
return (highIndex, lowIndex)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.