Skip to content

Instantly share code, notes, and snippets.

@mickeypash
Created July 2, 2020 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mickeypash/778ded2736d3496d2194ed3807289214 to your computer and use it in GitHub Desktop.
Save mickeypash/778ded2736d3496d2194ed3807289214 to your computer and use it in GitHub Desktop.
It's like a more advanced FizzBuzz
"""
Russian fighter program
Day 1 5, 4, 3, 2, 1
Day 2 5, 4, 3, 2, 2
Day 3 5, 4, 3, 3, 2
Day 4 5, 4, 4, 3, 2
Day 5 5, 5, 4, 3, 2
Day 6 Off
Day 7 6, 5, 4, 3, 2
Day 8 6, 5, 4, 3, 3
Day 9 6, 5, 4, 4, 3
Day 10 6, 5, 5, 4, 3
Day 11 6, 6, 5, 4, 3
Day 12 Off
"""
def gen_reps(start_reps):
initial_reps = [i for i in reversed(range(1, start_reps + 1))][:5]
i = len(initial_reps) - 1
while True:
yield initial_reps
initial_reps[i % 5] += 1
i -= 1
def main(days=30):
reps = gen_reps(5)
for day in range(1, days + 1):
msg = None
if day % 6 == 0:
msg = "Off"
else:
msg = ", ".join(str(i) for i in next(reps))
print(f"Day {day} {msg}")
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment