Using the code below, answer the following questions: 1) What are each of the 3 functions responsible for? 2) How many parameters will each function have? 3) What does each function return? 4) How will the program be controlled? 5) What functions will it call? 6) How will it communicate the results with the user?  ********************************************* Code starts here ************************************************** Module.py    #Defination to sort the list def sort(listNum):     sortedList = []     #While loop will run until the listNum don't get null     while(len(listNum) != 0 ):         #Set the min as first element in list         min = listNum[0]         #iterate over the list to compare every element with num             for ele in listNum:             #If element is less than min             if ele < min:                 #Then set min as element                 min = ele         #append the sorted element in list         sortedList.append(min)         #Remove the sorted element from the list         listNum.remove(min)         return sortedList #Function to find the sum of all elements in list def SumOfList(listNum):     #Set the sum as zero     sum =0     #Iterate over the list to get every element     for ele in listNum:         #Keep adding the element to the sum variable         sum = sum + ele     #returnt the sum     return sum #Function to find the max of the list def listMax(listNum):     #To store the max     max =0     #Iterate over the list     for ele in listNum:         #If element is greater than max then max = element         if(ele>max):             max = ele     #Return the max     return max   *************************************************************************************** Main .py      #Import the module file having the 3 functions import module import random def main():     #use the random module to create the list of random integers     #To store the random numbers in range 0 to 10     randomList = []     #Create the loop to create the list of 5 random integers     for i in range(0,5):         #Use randint to create the random integer         num = random.randint(0,10)         #Add the random integer into the list         randomList.append(num)         #Now create the menu to let user choose from what to perform on the random list     print("Random list created  : ",randomList,"\nSpecify what operations you wanna perform on the list")     print("1:Sorting\n2:Sum of all elements \n3:Maximum\nChooce 1-3 :  ",end = "")     #Now take input from the user     choice = int(input())     #Now use decision structures to decide which function to call from module.py     if(choice == 1 ):         #Print the sorted list         print("Sorted list as follows : " ,module.sort(randomList))     elif(choice == 2):         #Print the sum of all elements in list         print("The sum of all elements in list : ",module.SumOfList(randomList))     elif(choice == 3):         #print the maximum of list         print("The maximum of list is :  ",module.listMax(randomList)) #When the __name__ will be ___main__ the main function will be called. if __name__ == "__main__":     main()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Using the code below, answer the following questions:

1) What are each of the 3 functions responsible for?

2) How many parameters will each function have?

3) What does each function return?

4) How will the program be controlled?

5) What functions will it call?

6) How will it communicate the results with the user? 

********************************************* Code starts here **************************************************

Module.py 

 

#Defination to sort the list
def sort(listNum):
    sortedList = []

    #While loop will run until the listNum don't get null
    while(len(listNum) != 0 ):
        #Set the min as first element in list
        min = listNum[0]
        #iterate over the list to compare every element with num    
        for ele in listNum:
            #If element is less than min
            if ele < min:
                #Then set min as element
                min = ele
        #append the sorted element in list
        sortedList.append(min)
        #Remove the sorted element from the list
        listNum.remove(min)    
    return sortedList


#Function to find the sum of all elements in list
def SumOfList(listNum):
    #Set the sum as zero
    sum =0
    #Iterate over the list to get every element
    for ele in listNum:
        #Keep adding the element to the sum variable
        sum = sum + ele
    #returnt the sum
    return sum


#Function to find the max of the list
def listMax(listNum):
    #To store the max
    max =0
    #Iterate over the list
    for ele in listNum:
        #If element is greater than max then max = element
        if(ele>max):
            max = ele
    #Return the max
    return max
 
***************************************************************************************

Main .py 
 
 
#Import the module file having the 3 functions
import module
import random

def main():
    #use the random module to create the list of random integers
    #To store the random numbers in range 0 to 10
    randomList = []
    #Create the loop to create the list of 5 random integers
    for i in range(0,5):
        #Use randint to create the random integer
        num = random.randint(0,10)
        #Add the random integer into the list
        randomList.append(num)
   
    #Now create the menu to let user choose from what to perform on the random list
    print("Random list created  : ",randomList,"\nSpecify what operations you wanna perform on the list")
    print("1:Sorting\n2:Sum of all elements \n3:Maximum\nChooce 1-3 :  ",end = "")
    #Now take input from the user
    choice = int(input())
    #Now use decision structures to decide which function to call from module.py
    if(choice == 1 ):
        #Print the sorted list
        print("Sorted list as follows : " ,module.sort(randomList))
    elif(choice == 2):
        #Print the sum of all elements in list
        print("The sum of all elements in list : ",module.SumOfList(randomList))
    elif(choice == 3):
        #print the maximum of list
        print("The maximum of list is :  ",module.listMax(randomList))

#When the __name__ will be ___main__ the main function will be called.
if __name__ == "__main__":
    main()
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Events
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education