<commit_before>"""
A quick script to calculate and display the number of kg plates 
on each side of a 45lb barbell. I am lazy and don't like to do
basic math at the gym. Also how I am staring to learn python.
"""
import math

kilogram = 2.20462262185
largestPlate = 20 #40 if the gym has it

def getKg( weight ):	
	try:
		convertedWeight = float(weight)
		#remove bar
		convertedWeight -= 45
		convertedWeight = convertedWeight / kilogram
	except:
		print("Enter a number dickweed.")
		return 0
	return convertedWeight

def getSide( weight ):
	singleSide = weight / 2.00
	return(math.floor(singleSide))

#Buckle up, it's recursion time
def getPlates( weight, plate ):
	plateCount = weight/plate
	remaningWeight = weight%plate
	
	if not(plateCount < 1):
		print("%0.1Fkg x %d" % (plate, plateCount))

	if(remaningWeight < 2.5):
		return

	if not(plate <= 2.5):
		getPlates(remaningWeight, plate/2)

tableLines = "\n-------------------------\n"

while(True):
	user_input = input("Enter Weight in LBS: ")
	side = getSide(weight)
	print(tableLines)
	print("Weights assume a 45lb bar")
	print("Weight per side: %dkg" % (side))
	print("-----Plates per side-----")
	getPlates(side,largestPlate)
	print(tableLines)<commit_msg>Fixed logic issue that broke checkin. Also made calculations and plate display more precise<commit_after>"""
A quick script to calculate and display the number of kg plates 
on each side of a 45lb barbell. I am lazy and don't like to do
basic math at the gym. Also how I am staring to learn python.
"""
import math

kilogram = 2.20462262185
largestPlate = 20 #40 if the gym has it
barbell = 45 / kilogram

def getKg( weight ):	
	try:
		convertedWeight = float(weight)
		convertedWeight = convertedWeight / kilogram
	except:
		print("Enter a number dickweed.")
		return 0
	return convertedWeight

def getSide( weight ):
		singleSide = float(weight) / 2.00
		singleSide -= (barbell / 2.00)
		return(singleSide)

#Buckle up, it's recursion time
def getPlates( weight, plate ):
	plateCount = weight/plate
	remaningWeight = weight%plate
	
	if not(plateCount < 1):
		print("%0.1Fkg x %d" % (plate, plateCount))

	if(remaningWeight <= 0 or plate == 0.5):
		return

	if (plate < 5):
		getPlates(remaningWeight, (plate - 0.5))
	else:
		getPlates(remaningWeight, plate/2)

tableLines = "\n-------------------------\n"

while(True):
	user_input = input("Enter Weight in LBS: ")
	kgWeight = getKg(user_input)
	side = getSide(kgWeight)
	print(tableLines)
	print("Weights assume a 45lb bar")
	print("Weight per side: %0.1Fkg" % (side))
	print("-----Plates per side-----")
	getPlates(side,largestPlate)
	print(tableLines)
{'fraction_non_alphanumeric': 0.13109756097560976, 'fraction_numerical': 0.028582317073170733, 'mean_word_length': 3.704301075268817, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2914835', 'n_tokens_mistral': 975, 'n_tokens_neox': 870, 'n_words': 297}