Discuss / Python / 练习

练习

Topic source

def findMinAndMax(L):

  min=L[0]

  max=L[0]

  for num in L:

    if num<min:

      min=num

    elif num>max:

      max=num

  print(f'min={min} max={max}')

findMinAndMax([1,3,5,7,9,15])


  • 1

Reply