练习循环打印*时,一时脑洞大开,正好昨天是圣诞节,我们就来打印富有节日气息的图吧!(o゚▽゚)o
萌新代码请注意!先放图:
代码:
x=1
y=3
while x<11:
if x<10:
print('{0:^9}'.format('*'*x),end='')
if x==1:
print('{0:>22}'.format('*'))
elif x==3:
print('{0:>24}'.format('*****'))
elif x==5:
print('{0:>24}'.format('|^ ^|'))
elif x==7:
print('{0:>23}'.format('-'*3))
elif x==9:
print('{0:>7}'.format('\\ /'),end='')
print('{0:>18}'.format('#'*7))
x=x+2
# print(x)
while 7<=y<10:
print('{0:^9}'.format("*"),end=' ')
print('#'*8,end='')
if y==7:
print('{0:>7}'.format('#'),end='')
print('{0:>9}'.format('#'*7),end='')
print('{0:>3}'.format('#'))
if y==8:
print('{0:>16}'.format('#' * 7))
if y==9:
print('{0:>8}'.format('#'),end='')
print('{0:>8}'.format('#'))
y=y+1
y=y+1