Skip to content

Instantly share code, notes, and snippets.

@louisswarren
Created September 28, 2016 09:32
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 louisswarren/3d00e339f9fd97744fa4b898f8116ff6 to your computer and use it in GitHub Desktop.
Save louisswarren/3d00e339f9fd97744fa4b898f8116ff6 to your computer and use it in GitHub Desktop.
How to print a 64 page book on 4 a4 sheets
front = 16,1,14,3,12,5,10,7
back = 4,13,2,15,8,9,6,11
for x in range(4):
print("Sheet", x + 1)
for side in front, back:
print(',\t'.join(str(p + 16*x) for p in side))
print()
# Sheet 1
# 16, 1, 14, 3, 12, 5, 10, 7
# 4, 13, 2, 15, 8, 9, 6, 11
#
# Sheet 2
# 32, 17, 30, 19, 28, 21, 26, 23
# 20, 29, 18, 31, 24, 25, 22, 27
#
# Sheet 3
# 48, 33, 46, 35, 44, 37, 42, 39
# 36, 45, 34, 47, 40, 41, 38, 43
#
# Sheet 4
# 64, 49, 62, 51, 60, 53, 58, 55
# 52, 61, 50, 63, 56, 57, 54, 59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment