@computationalphysics-2014301020090
2016-09-25T19:04:53.000000Z
字数 2192
阅读 279
● Review the contents of the two courses on the main page of the cours master the grammar rules of Python and Matplotlib, and prepare for the next course.
● Moving your English name horizontally on the screen.
● Use the character to spell out what you want to draw on the 80*80 dot matrix, and let it spin, hoping to open the hole in the brain!
● Using python preliminarily.
● Learning how to use matplotlib.
● Master the basic knowledge of computer program.
L1:
import os
import time
i=os.system('cls')
a0 = " # # # # "
a1 = " # # # # # "
a2 = "# # # # # "
a3 = " # # # # "
a4 = " # # #### ### #### ### # ## #### ### "
a5 = " # # # # # # # # # # # # # # # # "
a6 = "# # # # ####### # # # # # # # # # # # "
a7 = " # # # # # # # # # # # # # # # # "
a8 = " # # # ### # # ### # # ## # # ### "
a9 = " # # "
a10 = " # # # # "
a11 = " # # # # "
a12 = " ## ## "
b = 0
while b < 8:
print (' '*b+a0)
print (' '*b+a1)
print (' '*b+a2)
print (' '*b+a3)
print (' '*b+a4)
print (' '*b+a5)
print (' '*b+a6)
print (' '*b+a7)
print (' '*b+a8)
print (' '*b+a9)
print (' '*b+a10)
print (' '*b+a11)
print (' '*b+a12)
time.sleep(0.7)
i=os.system('cls')
b += 1
L2:
import time
import os
a=("###########\n")
b=("###\n")
c=("##################\n")
d=(" ### ###\n")
e=3*a+2*b+3*a+6*b
f=3*c+4*d
g=6*b+3*a+2*b+3*a
h=4*d+3*c
li=[e,f,g,h]
i=0
while i<20:
print(li[i%4])
time.sleep(1)
i=i+1
os.system('cls')
该图形像字母F,又像一个旋转的扳手。
result:https://github.com/computationalphysics-N2014301020090/computational_physics_N2014301020090/blob/master/%E6%97%8B%E8%BD%AC%E5%9B%BE%E5%BD%A2.gif
another
import time
import os
a=(" ############\n")
b=(" ### ###\n")
c=(" #### \n")
d=("##################\n")
e=(" ## \n")
f=("##### ## ######\n")
k=(" ######### ##\n")
g=3*a+6*b+2*c+2*d+2*c+2*a+4*b
h=3*e+3*f+4*k+3*f+3*e
i=4*b+2*a+2*c+2*d+2*c+6*b+3*a
j=3*e+3*f+4*k+3*f+3*e
li=[g,h,i,j]
i=0
while i<20:
print(li[i%4])
time.sleep(1)
i=i+1
os.system('cls')
这是一个变形机器人@---@
result:https://github.com/computationalphysics-N2014301020090/computational_physics_N2014301020090/blob/master/%E6%97%8B%E8%BD%AC%E5%9B%BE%E5%BD%A22.gif
● This exercise is much more difficult than last one,but also much more interesting.
● After this exercise,I can use python a little more adroitly,and I've learnt more grammar about python.
● Matplotlib is really useful in physics studing.
● Still unable to use Python and Matplotlib Skillfully.
Thanks to Yang Zongmeng's code Guide