Skip to content

Instantly share code, notes, and snippets.

@andreppires
Last active January 29, 2019 11:37
Show Gist options
  • Save andreppires/68bba59e6e0595e1d0b4307e7f9be825 to your computer and use it in GitHub Desktop.
Save andreppires/68bba59e6e0595e1d0b4307e7f9be825 to your computer and use it in GitHub Desktop.
[Printer: Font and back] A simple script in python to calculate the front pages and the back pages depending in the initial page, the final page and the number of pages per side.
#read firt page
first= int(raw_input('First page to print? : '))
#read last page
last= int(raw_input('Last page to print? : '))
#pages the front
pages= int(raw_input('Pages per side? : '))
result={}
key='a'
result.setdefault(key, [])
key='b'
result.setdefault(key, [])
print "first was "+str(first)+" and last was "+str(last)
i='a'
for x in range(first, last+1, pages):
for z in range(0,pages):
result[i].append(x)
x=x+1
if (i=='a'):
i='b'
else:
i='a'
print "front page: "+str(result['a'])
print "back page: "+str(result['b'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment