我编写了一个python脚本,它根据用户根据所附图表(顶行是绘图长度,侧列是弓形磅数,这两个输入相交的地方是要使用的脊线)插入重量、绘图长度和磅数重量(按此顺序)来确定要使用的箭头脊线这个图表的过程是通过插入重量(只有2个选项)=>;绘制长度==>;船首手续费==>;要使用的脊椎。我将所有内容硬编码为第一次项目,但我只是觉得有更好的方法来实现这一点并减少代码量。下面是代码示例。可以在此处找到Repo:https://github.com/wayoh22/Easton-Arrow-Spine-Calculator/blob/main/Arrow_Spine_Calculator.py
Arrow Spine chart 。感谢您的帮助
raw_draw_length = input("Enter Draw Length (Round to Nearest Quarter Inch): ")
raw_bow_poundage = input("Enter Bow Poundage: ")
grain_insert_list = int(50) or int(75)
draw_length_list = [23.0, 23.25, 23.5, 23.75, 24.0, 24.25, 24.25, 24.5, 24.75, 25.0, 25.25, 25.5, 25.75, 26.0, 26.25, 26.5, 26.75, 27.0, 27.25, 27.5, 27.75, 28.0, 28.25, 28.5, 28.75, 29.0, 29.25, 29.5, 29.75, 30.0, 30.25, 30.5, 30.75, 31.0, 31.25, 31.5, 31.75, 32.0]
bow_poundage_list = range(23,86)
arrow_choice = "raw_arrow_input"
grain_insert = int(raw_grain_input)
draw_length = float(raw_draw_length)
bow_poundage = int(raw_bow_poundage)
if grain_insert != int(50) and grain_insert != int(75):
print ("Grainage not Supported")
if grain_insert == int(50):
if draw_length < float(23):
print("Draw Length Not Supported")
elif draw_length >= float(23.0) and draw_length <= float(23.4):
if bow_poundage < 69:
print("Bow Poundage not Supported")
if bow_poundage in range(69,86):
print("400 Spine")
if bow_poundage > 85:
print("Bow Poundage not Supported")
我要离开你包括的图片:
请注意,表中的每一列始终遵循相同的模式:
那么
现在我们将行索引放入表中。我们还可以轻松计算列索引:
现在来看最后一个技巧(如表中所示移动列):
相关问题 更多 >
编程相关推荐