Advertisement
Konark

Untitled

Mar 4th, 2024
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. numbers_list = [1, 5, 2, 4, 9, 12, 3, 6, 17, 20]
  2. min_num = None
  3. max_num = None
  4.  
  5. for num in numbers_list:
  6. if not min_num and not max_num:
  7. min_num = num
  8. max_num = num
  9.  
  10. if min_num > num:
  11. min_num = num
  12.  
  13. if max_num < num:
  14. max_num = num
  15.  
  16. print(min_num, max_num)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement