code1:
#!/usr/bin/env python
for i in range(1,10):
for x in range(1,10):
if x<=i:
num=x*i
print x,’x’,i,’=’,num,’ ‘,
code2:
#!/usr/bin/env python
i=1
while i<10:
x=1
l=[]
while x<=i:
num=x*i
a=’%d x %d = %d’%(x,i,num)
l.append(a)
x+=1
else:
for y in l:
print y,
i+=1
效果图: