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 #счетчик для положительных
- countMaxP = -1
- countO = 0 #счетчик для отрицательных
- countMaxO = -1
- for i in range(len(A)):
- if A[i] > 0:
- countP += 1
- if countMaxO < countO:
- countMaxO = countO
- countO = 0
- else: countO = 0
- elif A[i] < 0:
- countO += 1
- if countMaxP < countP:
- countMaxP = countP
- countP = 0
- else: countP = 0
- print(max(countMaxP, countMaxO))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement