Using a sort method and my previous code (put inside of addHoursmethod if possible), how would I get the list of each employee’stotal hours to display in order of least amount of hours togreatest. An explanation for each step would also be great.
import random
#Create function addHours
def addHours(lst):
#Display added hours of employees
print(“nEmployee# Weekly Hours”)
print(“—————————-“)
print(” 1 “,sum(lst[0]))
print(” 2 “,sum(lst[1]))
print(” 3 “,sum(lst[2]))
#Create main function
def main():
#Create first empty list and add random number
one=[]
for j in range(7):
one.append(random.randint(0,10))
#Create second empty list and add random number
two=[]
for j in range(7):
two.append(random.randint(0,10))
#Create third empty list and add random number
three=[]
for j in range(7):
three.append(random.randint(0,10))
#Create a list to combine previous lists
lst=[one,two,three]
#Display output of