在控制台连续输出五行*,每一行星号数量一次递增
*
**
***
****
*****
*****
****
***
**
*
*
**
***
****
*****
*****
****
***
**
*
"""
#_*_coding:utf-8_*_
Name:无重复三位数.py
Date:1/17/19
Author:
Connect:971566031@qq.com
Desc:
"""
row=1
while row<=5:
col=1
while col<=row:
print('*',end='')
col+=1
print('')
row+=1
row1=1
while row1<=5:
col1=1
while col1<=5-row1+1:
print('*',end='')
col1+=1
print('')
row1+=1
row3=1
while row3<=5:
kong1=1
while kong1<=5-row3:
print(" ",end='')
kong1+=1
col3=1
while col3<=row3:
print('*',end='')
col3+=1
print('')
row3+=1
row2=1
while row2<=5:
kong=1
while kong<row2:
print(" ",end='')
kong+=1
col2=1
while col2<=5-row2+1:
print('*',end='')
col2+=1
print('')
row2+=1
乘法表打印(正着打印,反着打印)
分别四种情况
a=1
while a<=9:
b=1
while b<=a:
print('%dx%d=%d\t'%(a,b,a*b),end='')
b+=1
a+=1
print('')
a=9
while a>=0:
b=1
while b<=a:
print('%dx%d=%d\t'%(a,b,a*b),end='')
b+=1
a-=1
print('')
a=1
while a<=9:
c=1
while c<=9-a:
print("\t\t",end=' ')
c+=1
b=1
while b<=a:
print('%dx%d=%d\t'%(a,b,a*b),end='')
b+=1
a+=1
print('')
a=9
while a>=0:
c=1
while c<=9-a:
print("\t\t\t",end='' )
c+=1
b=1
while b<=a:
print('%dx%d=%d\t'%(a,b,a*b),end='')
b+=1
a-=1
print('')
分别四种情况