Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pathlib import Path
- data = [(int(x) if len(x) > 0 else x) for x in Path("data/01.txt").read_text().split("\n")]
- x = 0
- r = []
- for n in data:
- if n == '':
- if x:
- r.append(x)
- x = 0
- r.append(n)
- else:
- x += n
- r=list(set(r))
- r.remove('')
- max(r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement