Add return statement by default

This commit is contained in:
David Doblas Jiménez 2021-10-30 16:52:15 +02:00
parent bee6519919
commit a311ea75f8

View File

@ -10,7 +10,8 @@ import inspect
def create_problem():
with open(Problem, "w+") as f:
template = inspect.cleandoc(f'''
template = inspect.cleandoc(
f"""
#=
Created on {today}
@ -29,6 +30,7 @@ def create_problem():
=#
# Your code goes here
return
end
@ -36,19 +38,18 @@ def create_problem():
@btime Problem{args['problem']}()
println("")
println("Result for Problem $(lpad({args['problem']}, 3, "0")): ", Problem{args['problem']}())
''')
"""
)
f.write(template)
if __name__ == '__main__':
if __name__ == "__main__":
today = datetime.datetime.now().strftime("%d %b %Y")
parser = ArgumentParser(description=__doc__)
# Add your arguments here
parser.add_argument("-p", "--problem",
help="number of the problem to solve")
parser.add_argument("-p", "--problem", help="number of the problem to solve")
args = vars(parser.parse_args())
Problem = f"Problem{(args['problem']):0>3}.jl"
create_problem()