Skip to content

Instantly share code, notes, and snippets.

@Jerdak
Last active December 27, 2021 18:45
Show Gist options
  • Save Jerdak/0fe3be39bba361be0d74 to your computer and use it in GitHub Desktop.
Save Jerdak/0fe3be39bba361be0d74 to your computer and use it in GitHub Desktop.
Quick (hacky) script to print tabulated workout weights for Wendler's 531 workout program.
try:
from tabulate import tabulate as tb
tabulated_style = True
except Exception as ex:
tabulated_style = False
# Replace these maxes with *your* maxes
actual_max = {
"benchpress":305,
"squat":405,
"pushpress":190,
"deadlift":440
}
# TM should be 90% of actual max (Following Wendler's Beyond 5/3/1 1.1 workout)
training_max = {k:v*0.90 for k,v in actual_max.items()}
# After each 4-5 week cycle of 531, add 5 lbs to bench and push presses and add 10 lbs to squat and deadlift
# **Reset these values to 0 if starting 531 for the first time.
training_max_adjustments = {
"benchpress":0,
"squat":0,
"pushpress":0,
"deadlift":0
}
training_max = {k:v+training_max_adjustments[k] for k,v in training_max.items()}
def print_new_style():
""" Use the `tabulate` module to prettily print weight tables
Notes:
To download tabulate: pip install tabulate
"""
max_table= [["lift","training_max", "actual_max"]] + [[key,value,actual_max[key]] for key,value in training_max.items()]
# Print training maxes
print(tb(max_table,headers="firstrow"))
print("\n")
# Print weight table by tenths of a percent
tens = [i/100. for i in range(0,110,10)]
weights = [[key]+[i*wt for i in tens] for key,wt in training_max.items()]
print(tb(weights,headers=['lift (10%)'] + tens))
print("\n")
# Print weight table by fifths of a percent
fives = [i/100. for i in range(5,115,10)]
weights = [[key]+[i*wt for i in fives] for key,wt in training_max.items()]
print(tb(weights,headers=['lift (5%)'] + fives))
def print_old_style():
""" Print weight tables using comma delimited format
Intended to be read by something like Excel.
For instance: python workout.py > weights.csv
"""
fives = [i/100. for i in range(5,115,10)]
tens = [i/100. for i in range(0,110,10)]
print("actual maxes: ",actual_max)
print("By 10%:")
print("lift," + ",".join([str(i) for i in tens]))
for key,weight in training_max.items():
print(key+"(%f)"%(weight)+",",",".join([str(weight * i) for i in tens]))
print("\nBy 10%(offset by 5):")
print("lift," + ",".join([str(i) for i in fives]))
for key,weight in training_max.items():
print(key+"(%f)"%(weight)+",",",".join([str(weight * i) for i in fives]))
if __name__=='__main__':
print_new_style() if tabulated_style else print_old_style()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment