import re
def nba_cup(result_sheet, to_find):
nums_of_item_w = ''
nums_of_item_l = ''
result_sheet = result_sheet.split(',')
score = 0
conceded = 0
wins = 0
loses = 0
draws = 0
mark = 0
for i in result_sheet:
if to_find in i:
j = re.findall('\b\d+\b', i)
for k in j:
if to_find in k:
print(k)
nums_of_item_w = re.findall('\b\d+\b', k)
if len(nums_of_item_w) > 1:
nums_of_item_w = nums_of_item_w[-1]
else:
nums_of_item_w = nums_of_item_w[0]
print(nums_of_item_w)
score += int(nums_of_item_w)
else:
nums_of_item_l = re.findall('\b\d+\b', k)
if len(nums_of_item_l) > 1:
nums_of_item_l = nums_of_item_l[-1]
else:
nums_of_item_l = nums_of_item_l[0]
print(nums_of_item_l)
conceded += int(nums_of_item_l)
if nums_of_item_w > nums_of_item_l:
wins += 1
mark += 3
elif nums_of_item_w < nums_of_item_l:
loses += 1
mark += 0
else:
draws += 1
mark += 1
print('W:', wins,'L:', loses, 'D', draws)
print('/'*261)
about_team = '{0}:W={1};D={2};L={3};Scored={4};Conceded={5};Points={6}'.format(to_find,wins,draws,loses,score,conceded,mark)
return about_team
import re
def nba_cup(result_sheet, to_find):
nums_of_item_w = ''
nums_of_item_l = ''
result_sheet = result_sheet.split(',')
score = 0
conceded = 0
wins = 0
loses = 0
draws = 0
mark = 0
for i in result_sheet:
if to_find in i:
j = re.findall('\b\d+\b', i)
for k in j:
if to_find in k:
print(k)
nums_of_item_w = re.findall('\b\d+\b', k)
if len(nums_of_item_w) > 1:
nums_of_item_w = nums_of_item_w[-1]
else:
nums_of_item_w = nums_of_item_w[0]
print(nums_of_item_w)
score += int(nums_of_item_w)
else:
nums_of_item_l = re.findall('\b\d+\b', k)
if len(nums_of_item_l) > 1:
nums_of_item_l = nums_of_item_l[-1]
else:
nums_of_item_l = nums_of_item_l[0]
print(nums_of_item_l)
conceded += int(nums_of_item_l)
if nums_of_item_w > nums_of_item_l:
wins += 1
mark += 3
elif nums_of_item_w < nums_of_item_l:
loses += 1
mark += 0
else:
draws += 1
mark += 1
print('W:', wins,'L:', loses, 'D', draws)
print('/'*261)
about_team = '{0}:W={1};D={2};L={3};Scored={4};Conceded={5};Points={6}'.format(to_find,wins,draws,loses,score,conceded,mark)
return about_team