Advertisement
Spocoman

08. Number sequence

Dec 23rd, 2021 (edited)
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. import sys
  2.  
  3. num = int(input())
  4. min_num = sys.maxsize
  5. max_num = -sys.maxsize
  6.  
  7. for i in range(num):
  8.     n = int(input())
  9.     if n < min_num:
  10.         min_num = n
  11.     if n > max_num:
  12.         max_num = n
  13.        
  14. print(f'Max number: {max_num}')
  15. print(f'Min number: {min_num}')
  16.  
  17.  
  18. Фундаменталс решение c list():
  19.  
  20. num = int(input())
  21. numbers = list()
  22.  
  23. for i in range(num):
  24.     numbers.append(int(input()))
  25.  
  26. print(f'Max number: {max(numbers)}\nMin number: {min(numbers)}')
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement