[关闭]
@Xc-liu 2016-04-03T11:46:45.000000Z 字数 1534 阅读 868

Homework_3

程序:

  1. line0=['#','#','#','#','#','#','#','#','#','#','#','#','#','#','#']
  2. line1=['#','#','#','#','#','#','#','#','#','#','#','#','#','#','#']
  3. line2=['#','#','#','#','#','#','#','#','#','#','#','#','#','#','#']
  4. line3=['#','#','#','#','#','#','#','#','#','#','#','#','#','#','#']
  5. line4=['#','#','#','#','#','#','#','#','#','#','#','#','#','#','#']
  6. def display_a1():
  7. line0[0:1]=[' ']
  8. line0[1:2]=[' ']
  9. line0[3:4]=[' ']
  10. line0[4:5]=[' ']
  11. line1[0:1]=[' ']
  12. line1[1:2]=[' ']
  13. line1[2:3]=[' ']
  14. line1[3:4]=[' ']
  15. line1[4:5]=[' ']
  16. line2[0:1]=[' ']
  17. line2[4:5]=[' ']
  18. line3[1:2]=[' ']
  19. line3[2:3]=[' ']
  20. line3[3:4]=[' ']
  21. line4[1:2]=[' ']
  22. line4[2:3]=[' ']
  23. line4[3:4]=[' ']
  24. def display_a2():
  25. line0[5:6]=[' ']
  26. line0[6:8]=[' ']
  27. line0[8:9]=[' ']
  28. line0[9:10]=[' ']
  29. line1[5:6]=[' ']
  30. line1[6:7]=[' ']
  31. line1[7:8]=[' ']
  32. line1[8:9]=[' ']
  33. line1[9:10]=[' ']
  34. line2[5:6]=[' ']
  35. line2[9:10]=[' ']
  36. line3[6:7]=[' ']
  37. line3[7:8]=[' ']
  38. line3[8:9]=[' ']
  39. line4[6:7]=[' ']
  40. line4[7:8]=[' ']
  41. line4[8:9]=[' ']
  42. def display_a3():
  43. line0[10:11]=[' ']
  44. line0[11:12]=[' ']
  45. line0[13:14]=[' ']
  46. line0[14:15]=[' ']
  47. line1[10:11]=[' ']
  48. line1[11:12]=[' ']
  49. line1[12:13]=[' ']
  50. line1[13:14]=[' ']
  51. line1[14:15]=[' ']
  52. line2[10:11]=[' ']
  53. line2[14:15]=[' ']
  54. line3[11:12]=[' ']
  55. line3[12:13]=[' ']
  56. line3[13:14]=[' ']
  57. line4[11:12]=[' ']
  58. line4[12:13]=[' ']
  59. line4[13:14]=[' ']
  60. display_a1()
  61. display_a2()
  62. display_a3()
  63. print line0
  64. print line1
  65. print line2
  66. print line3
  67. print line4

可以实现的功能:

需要改进的地方:

程序思路:

通过几个列表形成一个井号的点阵,再根据不同字母的形状和其需要显示的目标区域,去掉点阵中的一些井号。这样就会在目标区域显示相应字母的形状。(本程序中井号点阵分成三个5*5的小区域,故最多只能并列显示三个字母)

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