Skip to content

Instantly share code, notes, and snippets.

@liuderchi liuderchi/wk3-q3.py
Created Dec 8, 2015

Embed
What would you like to do?
wk3-q3
record = '''12.0 TOR Defensive Rebound by Terrence Ross
12.0 93-102 LAL D'Angelo Russell missed 3-pt. Jump Shot
25.0 93-102 TOR Cory Joseph made 2nd of 2 Free Throws
25.0 93-101 TOR Cory Joseph missed 1st of 2 Free Throws
25.0 LAL Personal foul on Kobe Bryant
39.0 93-101 LAL Kobe Bryant made 2nd of 2 Free Throws
39.0 92-101 LAL Kobe Bryant made 1st of 2 Free Throws
39.0 TOR Shooting foul on Bismack Biyombo
43.0 LAL Full Timeout
43.0 91-101 TOR Cory Joseph made 2nd of 2 Free Throws
43.0 91-100 TOR Cory Joseph made 1st of 2 Free Throws
43.0 LAL Shooting foul on Lou Williams
1:01 91-99 LAL Lou Williams made 3-pt. Jump Shot, Assist Jordan Clarkson '''
def count_shot(record):
result = 0
# Enter code Here
pos = 0
while pos != -1:
pos = record.find('Kobe Bryant made', pos + 1 )
if pos != -1:
result = result + 1
return result
print count_shot(record)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.