This assignment is Homework 26, and is due at classtime on Friday, May 5.

Assignment

The goal of this assignment is to write a Python program that writes two HTML files, one of which depends on some user input.

  1. First, your Python program should produce a HTML file that displays a color chart something like this:

    HTML color chart

    You must use a loop to write the HTML and CSS code that produces the colored boxes. For example, the colored boxes might be HTML <p> elements, with background colors set via the CSS background-color property.

    You may add more colors and more styles if you like.

  2. Second, your program should ask the user to enter a number. Your program should then write a HTML file that displays the first 8 powers (starting with the 0th power) of the number.

    For example, if the user enters 4, the HTML file generated by your program should look something like the following when displayed in a browser:

    powers of 4

    You must use a loop to write the HTML code that produces the powers. You may add more content and styles if you like.

For reference, you may wish to see helloWorldHTML.py from class. For help with HTML tags, see this HTML tutorial. For help with CSS selectors and properties, see this CSS tutorial. Fore more information about creating web pages with Python, see this page.

Submitting your work

Upload your Python file to the HW26 assignment on Moodle. You do not need to upload your HTML files.