Advertisement
Guest User

spaget

a guest
Dec 13th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. import re
  2.  
  3. def timeconvert(stroke, distance, course, toCourse, time):
  4.  
  5. def getSeconds(time):
  6. if re.search("\d{1,2}:", time) != None:
  7. minutes = re.search("\d{1,2}:", time).group()[:-1]
  8. seconds = re.search(":\d{1,2}", time).group()[1:]
  9. else:
  10. minutes = 0
  11. seconds = re.search("\d{1,2}\.", time).group()
  12.  
  13. if len(re.search("\.\d{1,2}", time).group()[1:]) < 2:
  14. hundreths = float((re.search("\.\d{1,2}", time).group()[1:])) * 10
  15. print(hundreths)
  16. else:
  17. hundreths = (re.search("\.\d{1,2}", time).group()[1:])
  18.  
  19. return (float(minutes) * 60) + (float(seconds)) + (float(hundreths) / 100)
  20.  
  21. def getfFactor(course, toCourse, distance, stroke):
  22. fFactor = 1.11
  23. course = course.lower()
  24. toCourse = toCourse.lower()
  25. stroke = stroke.lower()
  26.  
  27. if (course == "lcm" and toCourse == "scm"):
  28. fFactor = 1.0
  29. if (course == "lcm" and toCourse == "scy") or (course == "scy" and toCourse == "lcm") and (distance >= 400 and distance <=1000) and stroke != "im":
  30. fFactor = .8925
  31. if (course == "scy" and toCourse == "lcm") or (course == "lcm" and toCourse == "scy") and distance >= 1500:
  32. fFactor = 1.02
  33.  
  34. return fFactor
  35.  
  36. def increHelper(stroke):
  37. stroke = stroke.lower()
  38. if stroke == "fly" or stroke == "butterfly":
  39. return 70
  40. if stroke == "back" or stroke == "backstroke":
  41. return 60
  42. if stroke == "breast" or stroke == "breaststroke":
  43. return 100
  44. if stroke == "free" or stroke == "freestyle":
  45. return = 70
  46.  
  47. def getIncre(stroke, course, toCourse)
  48. if (course == "scy" and toCourse == "scm") or (course == "scm" and toCourse == "scy"):
  49. value = 0
  50.  
  51.  
  52.  
  53. time = "1:58.78"
  54.  
  55. 23.1
  56. print("Time: " + time + "\nIn seconds: " + str(getSeconds(time)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement