Advertisement
denvolf2000

Задача 6

Dec 16th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. from random import randint
  2.  
  3. A =  [randint(-100, 100) for i in range(25)]
  4. print(A) #для проверки
  5.  
  6. max1 = A[0]
  7. max2 = A[1]
  8. max1, max2 = max(max1, max2), min(max1, max2)
  9.  
  10. for i in range(2, len(A)):
  11.     if A[i] > max1:
  12.         max2 = max1
  13.         max1 = A[i]
  14.     elif A[i] < max1 and A[i] > max2:
  15.         max2 = A[i]
  16. print(max2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement