Solve e816 because I have to get easy ones for my Euler goal.

This commit is contained in:
2023-09-28 23:23:55 +02:00
parent 880385a451
commit 743966c7b8
2 changed files with 49 additions and 7 deletions

View File

@@ -1,5 +1,4 @@
FROM = 100
TILL = 100
import sys
TEMPLATE = """
def euler_XXX():
@@ -14,13 +13,17 @@ if __name__ == "__main__":
"""
for i in range(FROM, TILL + 1):
if i < 100:
e = "0" + str(i)
else:
e = str(i)
def main():
try:
e = sys.argv[1]
except IndexError:
print("Provide Euler problem number for which to create template.")
return
filename = "e" + e + ".py"
with open(filename, "w") as f:
s = TEMPLATE.replace("XXX", e)
f.write(s)
if __name__ == "__main__":
main()