Posts

Showing posts with the label python

Multiplication table in html with python

 #Generate multiplication table by html #https://ideone.com/YVXmga import random from copy import deepcopy N = 15 colors = ['F','E','D','C','B','A'] i = 0 colorsall = [] while i < N:     colornow = deepcopy(colors)     random.shuffle(colornow)     colornow = "#"+"".join(colornow)     colorsall.append(colornow)     i += 1 t = "" for i in range(1,N+1):     s = ''     for j in range(1,N+1):         if j >= i:             s += '<td style="background-color:' + colorsall[i-1] + '">'+str(i*j)+'</td>'         else:             s += '<td style="background-color:' + colorsall[j-1] + '">'+str(i*j)+'</td>'     s = "<tr>" + s + "</tr>"     t = t + s + '\n'      print('<table>' + t + '</table>') html code: <table><tr><td style...