Advertisement
zhongnaomi

the largest number in a list

Feb 6th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. #finding the largest number in a list
  2. my_list = [5,9,5,8,1,3]
  3.  
  4. def pop_sort(sorted):
  5.    
  6.     for _ in range(len(sorted) - 1):
  7.         if sorted[0] < sorted[-1]:
  8.             sorted[0]= sorted[-1]
  9.         sorted.pop()
  10. pop_sort(my_list)
  11. print (my_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement