Advertisement
AlexG2230954

Контрольная. Задание 1

May 28th, 2022
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. def can_parse(s):
  2.     return s != "0"
  3.  
  4. def get_end_month(s):
  5.     return int(s.split()[-1])
  6.  
  7. if __name__ == "__main__":
  8.     m = int(input())
  9.     months = []
  10.  
  11.     while True:
  12.         line = input()
  13.         if line == "0": break
  14.         months.append(get_end_month(line))
  15.  
  16.     print(len(tuple(filter(
  17.         lambda month: month == m,
  18.         months
  19.     ))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement