Computational Exercises: Solutions > Hello World (g02)

hello2_file.py

"""
Say hello to a file.
Spring 2020 PJW
"""

author_name = "Pete Wilcoxen"
outfile = "hello2_file.md"

author_msg = "Author: *"+author_name+"*\n"

fh = open(outfile,'w')

fh.write("# Hello, World!\n")
fh.write("\n")
fh.write(author_msg)
fh.write("\n")

days = 365
hours = 24

print("Hours per year:",days*hours,file=fh)

fh.close()
Site Index | Zoom | Admin
URL: https://wilcoxen.maxwell.insightworks.com/pages/5281.html
Peter J Wilcoxen, The Maxwell School, Syracuse University
Revised 02/08/2022