KaySawbridge

Largest and Smallest Numbers

Jul 27th, 2020 (edited)
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. def largest(list):
  2.     start=0
  3.     for number in list:
  4.         if number>start:
  5.             start=number
  6.     return start
  7.  
  8. def smallest(list):
  9.     start=2
  10.     for number in list:
  11.         if number<start:
  12.             start=number
  13.     return start
  14.  
  15. list=[1,13,4,11,4,50,33,15,10,12,12,45,2,1,-1]
  16. print(largest(list))
  17. print(smallest(list))
Add Comment
Please, Sign In to add comment