Last active
January 28, 2022 13:25
-
-
Save anemochore/41ebb2653c9e933a9403679c689ae599 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SPACE = 0.3 # em | |
[START, END] = [1, 7] # assuming positive integers | |
MID = round((END - START + 1)/2) | |
STR = ''.join(list(str(i) for i in range(START, END + 1))) | |
html = '<html><head><style>p {margin: 0;}</style></head><body>' | |
padding = 0 | |
for i in range(START, END + 1): | |
html += '<p style="padding-left: ' + str(padding * SPACE) + 'em;">' + STR[padding:len(STR) - padding] | |
padding += (1 if i < MID else -1) | |
with open('result.html', 'w') as f: | |
f.write(html + '</html>') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment