[关闭]
@wudawufanfan 2016-09-18T11:38:02.000000Z 字数 2373 阅读 971

打印自己的名字

姓名:吴帆帆 学号:2014301020154


未分类

摘要

Use the well number character to combine the corresponding letters with the technique of programme.
key words:Python      
     tool
     physical problems
     name

     

代码

  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Sat Sep 17 16:53:06 2016
  4. @author: 帆帆
  5. """
  6. def alphabet_combine(string,length):
  7. ####(('#######'),('#######'),('#######'),('#######'),('#######'),('#######'),('#######'))
  8. pa =((' # '),(' # # '),('# # '),('# ### # '),('# # '),('# # '),('# # '))
  9. pb =((' ##### '),('# # '),('# # '),('###### '),('# # '),('# # '),(' ##### '))
  10. pc =((' ##### '),('# # '),('# '),('# '),('# '),('# # '),(' ##### '))
  11. pd =(('###### '),('# # '),('# # '),('# # '),('# # '),('# # '),('###### '))
  12. pe =(('####### '),('# '),('# '),('###### '),('# '),('# '),('####### '))
  13. pf =(('####### '),('# '),('# '),('##### '),('# '),('# '),('# '))
  14. pg =((' ##### '),('# '),('# '),('# ### '),('# # '),('# ## '),(' #### # '))
  15. ph =(('# # '),('# # '),('# # '),('####### '),('# # '),('# # '),('# # '))
  16. pi =((' ##### '),(' # '),(' # '),(' # '),(' # '),(' # '),(' ##### '))
  17. pj =((' ##### '),(' # '),(' # '),(' # '),(' # '),(' # # '),(' ### '))
  18. pk =(('# # '),('# # '),('# # '),('#### '),('# # '),('# # '),('# # '))
  19. pl =((' # '),(' # '),(' # '),(' # '),(' # '),(' # '),(' ##### '))
  20. pm =(('# # '),('## ## '),('# # # # '),('# # # '),('# # '),('# # '),('# # '))
  21. pn =(('# # '),('## # '),('# # # '),('# # # '),('# # # '),('# ## '),('# # '))
  22. po =((' ##### '),('# # '),('# # '),('# # '),('# # '),('# # '),(' ##### '))
  23. pp =(('###### '),('# # '),('# # '),('###### '),('# '),('# '),('# '))
  24. pq =((' ##### '),('# # '),('# # '),('# # '),('# # # '),('# # '),(' #### # '))
  25. pr =(('###### '),('# # '),('# # '),('###### '),('# # '),('# # '),('# # '))
  26. ps =((' ###### '),('# '),('# '),(' ##### '),(' # '),(' # '),('###### '))
  27. pt =(('####### '),(' # '),(' # '),(' # '),(' # '),(' # '),(' # '))
  28. pu =(('# # '),('# # '),('# # '),('# # '),('# # '),('# # '),(' ##### '))
  29. pv =(('# # '),('# # '),('# # '),(' # # '),(' # # '),(' # # '),(' # '))
  30. pw =(('# # '),('# # '),('# # # '),('# # # '),('# # # '),('# # # # '),(' # # '))
  31. px =(('# # '),(' # # '),(' # # '),(' # '),(' # # '),(' # # '),('# # '))
  32. py =(('# # '),('# # '),(' # # '),(' # # '),(' # '),(' # '),(' # '))
  33. pz =(('####### '),(' # '),(' # '),(' # '),(' # '),(' # '),('####### '))
  34. p_ =((' '),(' '),(' '),(' '),(' '),(' '),(' '))
  35. dictionary = {' ':p_,'a':pa,'b':pb,'c':pc,'d':pd,'e':pe,'f':pf,'g':pg,'h':ph,'i':pi,'j':pj,'k':pk,'l':pl,'m':pm,'n':pn,'o':po,'p':pp,'q':pq,'r':pr,'s':ps,'t':pt,'u':pu,'v':pv,'w':pw,'x':px,'y':py,'z':pz}
  36. screen = [' ']*7
  37. for j in range(7):
  38. for i in range(length):
  39. screen[j] = screen[j] + dictionary[string[i]][j]
  40. print(screen[j])
  41. return screen
  42. def main():
  43. name = input('please input your name:')
  44. length = len(name)
  45. name = name.lower()
  46. alphabet_combine(name,length)
  47. main()

以下是这次运行的结果
QQ截图20160917173504.jpg
Thanks to Chengfeng for his codes in python 2.7 with my modification in python 3.5

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