for 循环练习

用 * 打印字符串

# 字符点阵
a = [[0,0,1,0,0,0],[0,1,0,1,0,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,1,1,1,1,0],[1,0,0,0,1,0],[1,0,0,0,1,0]]
b = [[1,1,1,1,0,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,1,1,1,0,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,1,1,1,0,0]]
c = [[0,1,1,1,0,0],[1,0,0,0,1,0],[1,0,0,0,0,0],[1,0,0,0,0,0],[1,0,0,0,0,0],[1,0,0,0,1,0],[0,1,1,1,0,0]]
d = [[1,1,1,1,0,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,1,1,1,0,0]]
e = [[1,1,1,1,1,0],[1,0,0,0,0,0],[1,0,0,0,0,0],[1,1,1,1,0,0],[1,0,0,0,0,0],[1,0,0,0,0,0],[1,1,1,1,1,0]]
f = [[1,1,1,1,1,0],[1,0,0,0,0,0],[1,0,0,0,0,0],[1,1,1,1,0,0],[1,0,0,0,0,0],[1,0,0,0,0,0],[1,0,0,0,0,0]]
g = [[0,1,1,1,0,0],[1,0,0,0,1,0],[1,0,0,0,0,0],[1,0,0,0,0,0],[1,0,1,1,1,0],[1,0,0,0,1,0],[0,1,1,1,1,0]]
h = [[1,0,0,0,1,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,1,1,1,1,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,0,0,0,1,0]]
i = [[0,1,1,1,0,0],[0,0,1,0,0,0],[0,0,1,0,0,0],[0,0,1,0,0,0],[0,0,1,0,0,0],[0,0,1,0,0,0],[0,1,1,1,0,0]]
j = [[0,0,1,1,1,0],[0,0,0,1,0,0],[0,0,0,1,0,0],[0,0,0,1,0,0],[0,0,0,1,0,0],[1,0,0,1,0,0],[0,1,1,0,0,0]]
k = [[1,0,0,0,1,0],[1,0,0,1,0,0],[1,0,1,0,0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,0,0,1,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[0,1,0,1,0,0],[0,0,1,0,0,0]]
w = [[1,0,0,0,1,0],[1,0,0,0,1,0],[1,0,0,0,1,0],[1,0,1,0,1,0],[1,0,1,0,1,0],[1,1,0,1,1,0],[1,0,0,0,1,0]]
x = [[1,0,0,0,1,0],[1,0,0,0,1,0],[0,1,0,1,0,0],[0,0,1,0,0,0],[0,1,0,1,0,0],[1,0,0,0,1,0],[1,0,0,0,1,0]]
y = [[1,0,0,0,1,0],[1,0,0,0,1,0],[0,1,0,1,0,0],[0,0,1,0,0,0],[0,0,1,0,0,0],[0,0,1,0,0,0],[0,0,1,0,0,0]]
z = [[1,1,1,1,1,0],[0,0,0,0,1,0],[0,0,0,1,0,0],[0,0,1,0,0,0],[0,1,0,0,0,0],[1,0,0,0,0,0],[1,1,1,1,1,0]]

打印单个字母

abc = input('input word :')
for alpha  in abc:
    for ii in range(7):
        for kk in range(6):
            if eval(alpha)[ii][kk] == 1:
                print("* ", end = "")
            if eval(alpha)[ii][kk] == 0:
                print("  ", end = "")
        print()
  • 单个字符输出效果:
input word :abc
    *       
  *   *     
*       *   
*       *   
* * * * *   
*       *   
*       *   
* * * *     
*       *   
*       *   
* * * *     
*       *   
*       *   
* * * *     
  * * *     
*       *   
*           
*           
*           
*       *   
  * * *     

打印字符串

abc = input('input word :')
str0 = []

for kk in range(7): 
    str1 = []
    for alpha in abc:
        str1.append(eval(alpha)[kk])
    str0.append(str1)    

for high in range(7):
    for length in range(len(abc)):
        for width in range(6):
            if str0[high][length][width] == 1:
                print("* ", end = "")
            if str0[high][length][width] == 0:
                print("  ", end = "")
    print()
  • 字符串输出效果:
input word :good
  * * *       * * *       * * *     * * * *     
*       *   *       *   *       *   *       *   
*           *       *   *       *   *       *   
*           *       *   *       *   *       *   
*   * * *   *       *   *       *   *       *   
*       *   *       *   *       *   *       *   
  * * * *     * * *       * * *     * * * *     

你可能感兴趣的:(for 循环练习)