MecSimCalc
ExploreSearchCreateDocsCommunityBlogPricing
    Apps

    Starred
    Go to app
    App Docs

Code:


def build_html_table(columns, ColumnHeaders):
    #  is the table
    #  is table row
    # "
    # (2) Add header row
    rows=len(columns[0])
    for h in ColumnHeaders:
        html_table += ""
    html_table += ""
    # (3) Add all data rows
    for i in range(rows):
        html_table += ""
        for column in columns:
            html_table += ""
        html_table += ""
    # (4) Add the table closing tag
    html_table += "
 is table header     #  is table data cell     # (1) Table opening table     html_table = "
"+h+"
"+str(column[i])+"
"     return html_table def main(inputs):     m=inputs['multiplier']     r=inputs['range']     col1=[m for i in range(r)]     col2=[i+1 for i in range(r)]     col3=[col1[i]*col2[i] for i in range(r)]     columns=[col1,col2,col3]     ColumnHeaders=["First Number", "Second Number","Product"]     table=build_html_table(columns,ColumnHeaders)     return {"Multiplier": m, "Table":table }


Output:

The following is the multiplication table of {{outputs.Multiplier}}

{{ outputs.Table }}
Similar apps:
Tutorial
Tutorial

Copyright © MecSimCalc 2024
Terms | Privacy