Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def nameMedals(last, first):
- gold = int('0')
- silver = int('0')
- bronze = int('0')
- lastflag = False
- firstflag = False
- flag = False
- with open("athletes.txt", encoding= 'utf-8') as file:
- for line in file:
- line = line.strip()
- if line == last:
- lastflag = True
- elif line == first:
- firstflag == True
- elif lastflag == True and firstflag == True:
- flag = True
- # Added new elif statement here
- elif flag == True:
- if line == '1':
- gold +=1
- elif line == '2':
- silver +=1
- elif line == '3':
- bronze +=1
- # Moved them here
- flag = False
- lastflag = False
- firstflag = False
- else:
- print("The name you specified is incorrect or is not in the data.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement