Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tasks = [int(x) for x in input().split(' ')]
- def valid_idx(i: int, x: list):
- return 0 <= x[i] < len(x)
- while True:
- command = input()
- if command == 'End':
- break
- else:
- tokens = command.split(' ')
- cmd = tokens[0]
- if cmd == 'Complete':
- idx = int(tokens[1])
- if valid_idx(idx, tasks):
- tasks[idx] = 0
- elif cmd == 'Change':
- idx = int(tokens[1])
- if valid_idx(idx, tasks):
- time = int(tokens[2])
- tasks[idx] = time
- elif cmd == 'Drop':
- idx = int(tokens[1])
- if valid_idx(idx, tasks):
- tasks[idx] = -1
- elif cmd == 'Count':
- typo = tokens[1]
- if typo == 'Completed':
- print(len([x for x in tasks if x == 0]))
- elif typo == 'Incomplete':
- print(len([x for x in tasks if x > 0]))
- elif typo == 'Dropped':
- print(len([x for x in tasks if x < 0]))
- print(' '.join([str(x) for x in tasks if x > 0]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement