Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Python by sasha ( 15 years ago )
#!/usr/bin/python3

class Athlet:
 def __init__(self, a_name, a_dob=None, a_times=[]):
  self.name = a_name
  self.dob = a_dob
  self.times = a_times
 
 def top3(self):
  return(sorted(set([sanitize(t) for t in self.times]))[0:3])

def coach_data(filename):
 try:
  with open(filename) as f:
   data = f.readline()
  templ = data.strip().split(',')
  return Athlet(templ.pop(0), templ(0), templ)
 except IOError as ioerr:
  print('File error: ' + str(ioerr))
  return(None)

james = coach_data('james2.txt')
print(james.name + "'s fastest times are: " + str(james.top3()))

 

Revise this Paste

Parent: 36460
Children: 36463
Your Name: Code Language: