Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

debug this python code. there are six bugs code - def main(): #declare variables

ID: 3836580 • Letter: D

Question

debug this python code. there are six bugs

code -

def main():
#declare variables
Bundles = [235, 756, 656, 125, 347, 810, 801]
Total = float()

PrintBundles(Bundles)
Total = GetTotal(Bundles)
GetAvg(Bundles)
FindHighest(Bundles)
FindLowest(Bundles)

def PrintBundles():
#declare local variables
index = int()

#loop to print out bundles
print("Total Bundles By Day")
print("--------------------")
for index in range(0, len(Bundles)):
print(index + 1, "). ", Bundles[index])

def GetTotal(Bundles):
#declare local variables
totalbundles = float()

#Get the total number of bundles collected
totalbundles = sum(Bundles)

def GetAvg(Bundles, Total):
#declare local variables
index = int()
average = float()
  
#determine average
average = Total/len(Bundles)
  
#print total and average
print("The total number of bundles collected: ", Total)
print("The total average number of bundles collected: ", format(average, '.2f'))

def FindHighest(Bundles):
#declare local variables
index = int()
highValue = int()
>

#Setting initial value for highValue
highValue = Bundles[0]

#Determine highest value
for index in range(0, 7):
> if oneBundle < highValue:
highValue = oneBundle
#end if
#print the highest value
print("The highest value is: ", highValue)

def FindLowest(Bundles):
#declare local variables
lowest_bundles = float()

#Find the lowest bundle
lowest_bundle = max(Bundles)

#printing the lowest bundles
print("The lowest value is: ", lowest_bundle)

#end code

here is the list of things that could be wrong.

When calling FindHighest the variable Total is missing in the argument list When defining GetTotal0, the parameter Total is missing. Did not call main Used min when it should be max When finding the lowest bundle, the methods max/min should not be used. Did not call FindHighest0 Used max when it should be min Missing Total when calling omparison operator is in the wrong direction Missing Bundles in definition statement n Find Lowest the value lowest bundles needs to be returned to main Missing return totalbundles

Explanation / Answer

Here are six bug

Did not call main()
Midding Bundles in definition statement
Missing Total when calling
Missing return totalbundles
Comparison operator is in the wrong direction
used max when ut should be min

Here is fixed code

def main():
#declare variables
Bundles = [235, 756, 656, 125, 347, 810, 801]
Total = float()
PrintBundles(Bundles)
Total = GetTotal(Bundles)
GetAvg(Bundles, Total)
FindHighest(Bundles)
FindLowest(Bundles)
def PrintBundles(Bundles):
#declare local variables
index = int()
#loop to print out bundles
print("Total Bundles By Day")
print("--------------------")
for index in range(0, len(Bundles)):
print(index + 1, "). ", Bundles[index])
def GetTotal(Bundles):
#declare local variables
totalbundles = float()
#Get the total number of bundles collected
totalbundles = sum(Bundles)
return totalbundles
def GetAvg(Bundles, Total):
#declare local variables
index = int()
average = float()
  
#determine average
average = Total/len(Bundles)
  
#print total and average
print("The total number of bundles collected: ", Total)
print("The total average number of bundles collected: ", format(average, '.2f'))
def FindHighest(Bundles):
#declare local variables
index = int()
highValue = int()
> #Setting initial value for highValue
highValue = Bundles[0]
#Determine highest value
for index in range(0, 7):
> if oneBundle > highValue:
highValue = oneBundle
#end if
#print the highest value
print("The highest value is: ", highValue)
def FindLowest(Bundles):
#declare local variables
lowest_bundles = float()
#Find the lowest bundle
lowest_bundle = min(Bundles)
#printing the lowest bundles
print("The lowest value is: ", lowest_bundle)
#end code
main()

# code link: https://paste.ee/p/6FPZe