Question: Please update this PYTHON program so User can input any numbers to the list after run the program ! #code.py def calculate(lst): maxVal = lst[0]
Please update this PYTHON program so User can input any numbers to the list after run the program!
#code.py def calculate(lst): maxVal = lst[0] minVal = lst[0] evens = 0 odds = 0 for x in lst: if(maxVal < x): maxVal = x if(minVal > x): minVal = x if(x%2 == 0): evens += 1 else: odds += 1 print("Max =", maxVal) print("Min =", minVal) print("Evens =", evens) print("Odds =", odds) print("Cumulative total: ",end="") temp = 0 for x in lst: temp += x print(temp, end=" ") pre = lst[0] i = 1 print(" Adjacent duplicates: ",end="") while iFalse while(pre == lst[i] and iTrue if(flag): print(pre,end=" ") pre = lst[i] i += 1 print(" --------------------") calculate([1, 3, 3, 4, 5, 5, 6, 6, 6, 2]) calculate([1, 7, 2, 9])
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
