Hi,

I created an interesting html table and colored it, using Python. I
tried putting the code into SAGE, but I just could not seem to get it
to work (just a bunch of \n's).

http://tclemans.nonlogic.org/table.html

def dt(s):
    string = "<html>\n"
    string += "<head>\n"
    string += "<title>Factor Table</title>\n"
    string += "<style>\n"
    string += "table {margin: 0; padding: 0; border: 1px solid #ccc;}\n"
    string += "tr {margin: 0; padding: 0; border: 1px solid #ccc;}\n"
    string += "td {margin: 0; padding: 0; border: 1px solid #ccc;
width: 20px; height; 20px;}\n"
    string += "#yes {background: red; margin: 0; padding: 0; width;
20px; height: 20px;}\n"
    string += "#no {background: blue; margin: 0; padding: 0; width;
20px; height: 20px;}\n"
    string += "</style>\n"
    string += "<body>\n"
    string += "<table>\n"

    for a in range(1,s+1):
        string += "<tr>"
        for b in range(1,s+1):
            if a%b == 0:
                string += '<td id="yes"></td>'
            else:
                string += '<td id="no"></td>'
        string += "</tr>\n"
    string += "</table>\n</body>\n</html>\n"
    return string

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to