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) #для проверки
- countP = 0
- countN = 0
- countMaxP = 0
- countMaxN = 0
- i = 0
- for i in range(len(A)):
- if A[i] > 0:
- countP += 1
- if countMaxN < countN:
- countMaxN = countN
- countN = 0
- elif A[i] < 0:
- if countMaxP < countP:
- countMaxP = countP
- countP = 0
- countN += 1
- elif A[i] == 0:
- if countMaxN < countN:
- countMaxN = countN
- if countMaxP < countP:
- countMaxP = countP
- countP = 0
- countN = 0
- print(max(countMaxN, countMaxP))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement