#write a function max that has one parameter - number of inputs, num #function reads num integers #function finds and returns the maximal value among inputs #write main to test your function def max(num): max_value=int(input("enter first integer ")) for i in range(num-1): #we need to read num-1 remaining inputs input_num=int(input("enter next input ")) if(input_num>max_value): max_value=input_num return max_value def main(): num=int(input("enter number of inputs ")) if(num>0): result=max(num) print("max =", result) else: print("empty input") main() #We will trace the program on the following input #num=4 input numbers: 2, -3, 6, 5 #max_value=2 #the loop starts input_num=-3 #if(-3>2) False so nothing is changed #continue with the loop we read next input input_num=6 #if(6>2) True so max_value=6 #continue with the loop we read next input input_num=5 #if(5>6) False nothing is changed #Loop is done #function returns max_value=6