Advertisement
Guest User

Untitled

a guest
Nov 19th, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.62 KB | None | 0 0
  1. def splitplace(a, b):
  2.  
  3.     import time
  4.     text= open('C:\Users\[USER]\Desktop\splits.txt', 'r')
  5.     lines = []
  6.     _3k=[]
  7.     _3k_2=[]
  8.     _5k=[]
  9.     time3k=[]
  10.     time5k=[]
  11.     threeplace=1
  12.     threetied=0
  13.     fiveplace=1
  14.     fivetied=0
  15.     for line in text:
  16.         lines.append(line)
  17.     for i in lines:
  18.         temp=i.split()
  19.         _3k.append(temp[1])
  20.     for i in lines:
  21.         temp=i.split()
  22.         _5k.append(temp[3])
  23.     for i in _3k:
  24.         _3k_2.append(i.replace(";", ""))
  25.     _3k=_3k_2
  26.     for i in _3k:
  27.         time3k.append(time.strptime(i, "%M:%S"))
  28.  
  29.     for i in _5k:
  30.         time5k.append(time.strptime(i, "%M:%S"))
  31.  
  32.     threetime = a
  33.     fivetime = b
  34.     threetime = time.strptime(threetime, "%M:%S")
  35.     fivetime = time.strptime(fivetime, "%M:%S")
  36.  
  37.  
  38.     for i in time3k:
  39.         if i.tm_min<threetime.tm_min:
  40.             threeplace=threeplace+1
  41.         elif i.tm_min==threetime.tm_min:
  42.             if i.tm_sec<threetime.tm_sec:
  43.                 threeplace=threeplace+1
  44.             elif i.tm_sec==threetime.tm_sec:
  45.                 threetied=threetied+1
  46.  
  47.     for i in time5k:
  48.         if i.tm_min<fivetime.tm_min:
  49.             fiveplace=fiveplace+1
  50.         elif i.tm_min==fivetime.tm_min:
  51.             if i.tm_sec<fivetime.tm_sec:
  52.                 fiveplace=fiveplace+1
  53.             elif i.tm_sec==fivetime.tm_sec:
  54.                 fivetied=fivetied+1
  55.  
  56.     print("Your place at the 3k was " +str(threeplace))
  57.     print("You were tied with " +str(threetied)+ " at the 3k")
  58.     print("Your place at the 5k was " +str(fiveplace))
  59.     print("You were tied with " +str(fivetied)+ " at the 3k")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement