Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- A = [randint(-100, 100) for i in range(25)]
- print(A) #для проверки
- max1 = A[0]
- max2 = A[1]
- max1, max2 = max(max1, max2), min(max1, max2)
- for i in range(2, len(A)):
- if A[i] > max1:
- max2 = max1
- max1 = A[i]
- elif A[i] < max1 and A[i] > max2:
- max2 = A[i]
- print(max2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement