for i in range(1, 10): for j in range(1, i+1): n = i*j print('%s*%s=%s' % (i, j, n), end=' ') if i == j: print()