Create an HTML table: Difference between revisions

Added 11l
m (→‎{{header|Python}}: Remove unnecessary `''.join()`)
(Added 11l)
Line 7:
* The numbers should be aligned in the same fashion for all columns.
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>UInt32 seed = 0
F nonrandom(n)
:seed = 1664525 * :seed + 1013904223
R Int(:seed >> 16) % n
 
F rand9999()
R nonrandom(9000) + 1000
 
F tag(tag, txt, attr = ‘’)
R ‘<’tag‘’attr‘>’txt‘</’tag‘>’
 
V header = tag(‘tr’, ‘,X,Y,Z’.split(‘,’).map(txt -> tag(‘th’, txt)).join(‘’))"\n"
V rows = (1..5).map(i -> tag(‘tr’, tag(‘td’, i, ‘ style="font-weight: bold;"’)‘’(0.<3).map(j -> tag(‘td’, rand9999())).join(‘’))).join("\n")
V table = tag(‘table’, "\n"header‘’rows"\n")
print(table)</lang>
 
{{out}}
<pre>
<table>
<tr><th></th><th>X</th><th>Y</th><th>Z</th></tr>
<tr><td style="font-weight: bold;">1</td><td>7470</td><td>1256</td><td>9708</td></tr>
<tr><td style="font-weight: bold;">2</td><td>8769</td><td>8170</td><td>5750</td></tr>
<tr><td style="font-weight: bold;">3</td><td>5526</td><td>6945</td><td>7277</td></tr>
<tr><td style="font-weight: bold;">4</td><td>3128</td><td>8214</td><td>4337</td></tr>
<tr><td style="font-weight: bold;">5</td><td>5227</td><td>5006</td><td>1442</td></tr>
</table>
</pre>
 
=={{header|360 Assembly}}==
1,480

edits