Python简单输出9*9乘法表
输出9*9的乘法表
很简单,主要是python3和python2两者之间输出上的区别!代码如下:其中end的参数就是重写其中的print的函数!
// A code block
print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False);
这是函数的原型,我们只需要重写end参数的值即可!
// An highlighted block
i = 1;
while i <= 9:
j = 1;
while j <= i:
print('%d*%d=%d ' %(j, i, i*j), end = '\t');
j += 1;
print('');
i += 1;
输出结果如下: