Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mecz = 'mecz.txt'
- mecz_test = "mecz_przyklad.txt"
- with open(mecz) as file:
- line = file.readline()
- # 1.1
- count = 0
- for i in range(1, len(line) - 1):
- if str(line[i]) != str(line[i-1]):
- count = count + 1
- print(count)
- # 1.2
- a = 0
- b = 0
- for i in range(len(line) - 1):
- if line[i] == 'A':
- a = a + 1
- if line[i] == 'B':
- b = b + 1
- if (a >= 1000 or b >= 1000) and (abs(a - b) >= 3):
- print (f'{a}:{b}')
- break
- # 1.3
- streak_team = ''
- w = 1
- streaks = []
- for i in range(1, len(line) - 1):
- if line[i - 1] == line[i]:
- w = w + 1
- else:
- if w >= 10:
- well_streak = {}
- well_streak["team"] = line[i - 1]
- well_streak["streak"] = w
- streaks.append(well_streak)
- w = 1
- # get the max of ['streak'] and show it and the 'team' which make this score
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement