One, print 99 multiplication table:
#coding: Utf-8for i in range (1,10): for J in Range (1,i+1): Print ("%dx%d=%d")% (j,i,j*i), print ' \ n '
Results:
650) this.width=650; "title=" 99.png "alt=" wkiom1llma-trl7_aaassxicmss619.png-wh_50 "src=" https://s1.51cto.com/ Wyfs02/m02/99/bb/wkiom1llma-trl7_aaassxicmss619.png-wh_500x0-wm_3-wmp_4-s_2116397384.png "/>
Second, print the square
Entity Square Code:
#coding: Utf-8rows=int (raw_input ("Input square side length:")) for I in range (rows): Print ("*"), print
650) this.width=650; "title=" 11.png "alt=" wkiom1llmjob5v6caaad1-cabjk846.png-wh_50 "src=" https://s5.51cto.com/ Wyfs02/m02/99/bb/wkiom1llmjob5v6caaad1-cabjk846.png-wh_500x0-wm_3-wmp_4-s_1253390052.png "/>
Hollow Square Code:
#coding: Utf-8rows=int (raw_input ("Input square side length:")) for X in range (rows): If x!=0 and x! = Rows-1 : if y==0 or y = = rows-1: Print ("*"), Else:print (""), Els E:print ("*"), print ("\ n")
Effect:
650) this.width=650; "title=" 22.png "alt=" wkiol1llmowsh8xxaaahnve_ymm763.png-wh_50 "src=" https://s1.51cto.com/ Wyfs02/m00/99/bb/wkiol1llmowsh8xxaaahnve_ymm763.png-wh_500x0-wm_3-wmp_4-s_3653282803.png "/>
Third, print the Christmas tree
Code:
#coding: Utf-8rows=3for x in range (rows): For I in Range (1,13): If I% 2 ==0:continue else: Print (str (i * ' * '). Center (one)) for Y in range: print (' * '. Center (11))
Effect:
650) this.width=650; "title=" 333.png "alt=" wkiol1llmudwveufaaaih4qbhj0392.png-wh_50 "src=" https://s2.51cto.com/ Wyfs02/m01/99/bb/wkiol1llmudwveufaaaih4qbhj0392.png-wh_500x0-wm_3-wmp_4-s_275057874.png "/>
Four, print the Ling shape
Code:
#coding: Utf-8rows=10#while true:for i in range (1, rows): If I% 2 = = 0:continue Else:print (str (i * ') * '). Center (rows)) for I in range (rows): If I% 2 = = 0:continue Else:print (str ((rows-i) * ' * '). Cente R (rows))
Effect:
650) this.width=650; "title=" 88.png "alt=" wkiom1llm-ahewalaaadrywhooo780.png-wh_50 "src=" https://s4.51cto.com/ Wyfs02/m00/99/bb/wkiom1llm-ahewalaaadrywhooo780.png-wh_500x0-wm_3-wmp_4-s_3866568092.png "/>
Write simple, if there is better, please correct and communicate ~
This article is from the "end of the school" blog, please be sure to keep this source http://dyc2005.blog.51cto.com/270872/1941069
Python 99 multiplication table and print graphics program