@2014301020081
2016-09-25T14:31:17.000000Z
字数 1096
阅读 532
the
third
housework
by Defeng Kong (2014301020081)
I'll make my name move from left to right and from up to down in the sceern by the main commends'os.system('cls')'and'time.sleep(t)' of python.Of course,the loop statement'while' is also needed.
Last week, I draw my name by using python.This week,I'll make it move in the screen by using python too.
import os
import time
i=1
n1='********'
n2=' **'
n3=' ** *****'
n4=' ** ***** * * *'
n5=' ** * * * *'
n6=' ** * * * *'
n7=' ** * * * *'
n8=' ** * * * *'
n9='******** ****** ** * **'
a=' '
while(i<50):
print n1
print n2
print n3
print n4
print n5
print n6
print n7
print n8
print n9
n1=a+n1
n2=a+n2
n3=a+n3
n4=a+n4
n5=a+n5
n6=a+n6
n7=a+n7
n8=a+n8
n9=a+n9
i+=1
time.sleep(0.5)
os.system('cls')
2. from up to down
the code
import os
import time
i=1
n='''
********
**
** *****
** ***** * * *
** * * * *
** * * * *
** * * * *
** * * * *
******** ****** ** * **
'''
a='''
'''
while(i<50):
print(n)
n=a+n
i+=1
time.sleep(0.5)
os.system('cls')
run:
GIF of name
For the item from left to right,I can also use the way of making the
strings to the list.in this way,I can add the " "to the front of every elements of list more simplier.
For The second question,I can't make it by myself.
Defeng Kong