my_list = [1, 1, 0, 0, 1, 0, -1] # Не ясно указан формат ввода... примеров нет
class Cursor:
def __init__(self):
self.num = None
self.count = 0
def __call__(self, num):
if self.num is None:
self.num = num
if self.num == num:
self.count += 1
elif self.num > num:
self.count = 1
else:
pass
cursor = Cursor()
for i in my_list:
cursor(i)
print(cursor.count)
my_list = [1, 1, 0, 0, 1, 0, -1] # Не ясно указан формат ввода... примеров нет
class Cursor:
def __init__(self):
self.num = None
self.count = 0
def __call__(self, num):
if self.num is None:
self.num = num
if self.num == num:
self.count += 1
elif self.num > num:
self.count = 1
self.num = num
else:
pass
cursor = Cursor()
for i in my_list:
cursor(i)
print(cursor.count)