Created
November 10, 2023 11:36
-
-
Save jburgy/3a67e04df3af71e9fd48a0af92cdc14f to your computer and use it in GitHub Desktop.
Semantic html to help a child memorize their times table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| row = "<tr><th>{}</th>{}</tr>".format | |
| cell = ( | |
| '<td><input type="text" required minlength=1 maxlength=3' | |
| ' size=1 pattern={}></td>'.format | |
| ) | |
| print( | |
| """<html lang="en"> | |
| <head> | |
| <title>Multiplicatino Table</title> | |
| </head> | |
| <style> | |
| input:invalid {{ color: #c00; }} | |
| </style> | |
| <body> | |
| <table> | |
| <thead> | |
| <tr> | |
| <th>×</th> | |
| {} | |
| </tr> | |
| </thead> | |
| <tbody> | |
| {} | |
| </tbody> | |
| </table> | |
| </body> | |
| </html> | |
| """.format( | |
| "\n".join(f"<th>{i}</th>" for i in range(1, 13)), | |
| "\n".join( | |
| row(i, "\n".join(cell(i * j) for j in range(1, 13))) for i in range(1, 13) | |
| ), | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment