Fix problem number
This commit is contained in:
parent
7190721c5f
commit
022ae034d6
@ -10,7 +10,8 @@ import inspect
|
|||||||
|
|
||||||
def create_problem():
|
def create_problem():
|
||||||
with open(Problem, "w+") as f:
|
with open(Problem, "w+") as f:
|
||||||
template = inspect.cleandoc(f'''#!/usr/bin/env python3
|
template = inspect.cleandoc(
|
||||||
|
f'''#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Created on {today}
|
Created on {today}
|
||||||
|
|
||||||
@ -35,20 +36,19 @@ def create_problem():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
print(f"Result for Problem {{int({args['problem']}):003d}}: {{compute()}}")
|
print(f"Result for Problem {args['problem']}: {{compute()}}")
|
||||||
''')
|
'''
|
||||||
|
)
|
||||||
|
|
||||||
f.write(template)
|
f.write(template)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
|
|
||||||
today = datetime.datetime.now().strftime("%d %b %Y")
|
today = datetime.datetime.now().strftime("%d %b %Y")
|
||||||
parser = ArgumentParser(description=__doc__)
|
parser = ArgumentParser(description=__doc__)
|
||||||
# Add your arguments here
|
# Add your arguments here
|
||||||
parser.add_argument("-p", "--problem",
|
parser.add_argument("-p", "--problem", help="number of the problem to solve")
|
||||||
help="number of the problem to solve")
|
|
||||||
args = vars(parser.parse_args())
|
args = vars(parser.parse_args())
|
||||||
Problem = f"Problem{(args['problem']):0>3}.py"
|
Problem = f"Problem{(args['problem']):0>3}.py"
|
||||||
create_problem()
|
create_problem()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user