[关闭]
@zy-0815 2016-09-25T16:14:22.000000Z 字数 1323 阅读 984

1.问题

L1:在屏幕上让你的英文名字水平移动起来
L2:作业L2 在80*80点阵上用字符拼出你想画的东西,并让它旋转起来,希望脑洞大开!(比如字符、火柴人、火箭等等)

2.摘要

  本次作业主要根据python和matplotlib的语法规则,使文字或者图案在屏幕上能够平移或者旋转。

3.背景介绍

  通过对课堂内容的复习,我们已经能够编写一些简单的程序,而本次作业是为了加强练习,以便更深一步的学习。

4.正文 L1:

  1. x='1'
  2. d={'1':' '*1 ,'2':' '*2,'3':' '*3,'4':' '*4,'5':' '*4,'6':' '*4,'7':' '*4,'8':' '*4}
  3. import os
  4. import time
  5. times=input('Please input the times you want the name to move horiziontally')
  6. for y in range(times):
  7. for x in ['1','2','3','4','5','6','7','8']:
  8. i=os.system('cls')
  9. print d[x],'# # # ##############'
  10. print d[x],' # # # # #'
  11. print d[x],' # # # # #'
  12. print d[x],' # # # # # ######'
  13. print d[x],' # # ##############'
  14. print('\n')
  15. time.sleep(0.3)

5.正文 L2:

  1. x='1'
  2. d={'1':' '}
  3. import time
  4. import math
  5. import sys
  6. import os
  7. k=0
  8. j=1
  9. for x in range(2):
  10. for k in [0,0.25*math.pi,0.5*math.pi,0.6*math.pi,0.75*math.pi,1*math.pi,1.25*math.pi,1.5*math.pi,1.75*math.pi,2*math.pi,2.25*math.pi,2.5*math.pi,2.75*math.pi,3*math.pi]:
  11. i=os.system('cls')
  12. print ('\n')*int(math.sin(k)*5+6)
  13. print d['1']*int(math.cos(k)*25+30),'# # # ############'
  14. print d['1']*int(math.cos(k)*25+30),' # # # # #'
  15. print d['1']*int(math.cos(k)*25+30),' # # # # #'
  16. print d['1']*int(math.cos(k)*25+30),' # # # # # #####'
  17. print d['1']*int(math.cos(k)*25+30),' # # ############'
  18. time.sleep(0.3)

6.结论

  L1 : 加入“time”函数后使字母在移动过程中不会一闪而过,此种操作在控制循环间隔上有重要作用。
  L2:只是会这种简易的方式令图案旋转,而且感觉很多地方也有改进之处。

7.总结

1.How to think like a computer scientist – Learning with Python: Interactive Edition 2.0
2.感谢张梓桐同学的耐心帮助及宗玥同学提供作业部落的VIP账号

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注