Whichever program you choose to convert, first write out the main function, identifying the new functions you will create along with the input and output required by each new function. Then, step by step, convert the program to one that uses functions, and so has a very short and clean main() function, that simply calls the other functions.
You can leave this part of the lab unfinished in order to have about 20 or 30 minutes remaining to work on part 3. Part 3 of the lab will lead into the homework this week, and you want to be sure to have the basics down before leaving lab.
To begin, try running the following program. Run the program, look at the .html file created both in a text editor, and also in a web browser.
def makeHTML():
file = open("CSC111_Lab8.html", 'w')
file.write("""\n<html>\n<head><title>A Simple Page</title>
</head>
<body>
<h1>This is a first level heading font</h1>
<p>And here is some text</p>
<!--This is an HTML comment, which will not be displayed in the browser-->
<p>Here is some text after the comment.</p>
</body>
</html>""")
file.close()
def main():
makeHTML()
main()
• basic tags: <html> <head> <body> (along with the closing tags) • white space and new lines: <p> </p> <br /> • lists: <ul> <ol> <li> -- unordered list, ordered list, list item • pictures: <image height = "100" src = "...jpg"/> • Anchor tag: <a href = "someplace.html"> link text </a> ( "someplace.com" etc.) • tables: <table> <tr> <td> • formatting with color -- RGB in Hex • font: headings, italics, bold: <h1> <i> <b>