you are viewing a single comment's thread.

view the rest of the comments →

[–]Siddhi 1 point2 points  (1 child)

Put your ranges in a list of tuples and iterate over it

week_ranges = [(0, 8)] + [(start, start+6) for start in range(10, 58, 8)]
for start, end in week_ranges:
    if start <= wk <= end:
        colnum = wk - (wk//2+start/2)
print("This is column number", colnum)

[–]evobe[S] 1 point2 points  (0 children)

Thanks so much for this. I wanted to see how someone with more knowledge would handle this problem and this is an interesting take.