九九乘法表

#!/usr/bin/env python
# coding: utf-8

# In[23]:


for i in range (1,10):
    for j in range(1,i+1):
        print('{}x{}={:<2} '.format(i,j,j*i),end='')
    print()


# In[76]:


for i in range (1,10):
    s = ' '
    for j in range(1,i+1):

        if(i*j<10 and j>1):
            
            s = s+'{1} x {0} =  {2}   '.format(i,j,i*j)
        else:
            s = s+'{1} x {0} = {2}   '.format(i,j,i*j)
        #print('{}x{}={:<2} '.format(i,j,j*i),end='')
    #print('{:>120}'.format(s))
    print(s)


# In[55]:


for i in range (1,10):
    s = ' '
    for j in range(i,10):
        if(i*j<10):
            
            s = s+'{} x {} =  {}   '.format(i,j,i*j)
        else:
            s = s+'{} x {} = {}   '.format(i,j,i*j)
        #print('{}x{}={:<2} '.format(i,j,j*i),end='')
    print('{:>120}'.format(s))
    print()

 

posted @ 2018-10-18 20:56  快乐多巴胺  阅读(177)  评论(0编辑  收藏  举报