Read a lot of on-line multiplication formula printing, feel a lot of writing is not suitable for beginners to understand, today reference a few small examples, wrote this small script, hope to learn the novice look at this, understand Python in the while statement will have some help.
I wrote each line to help see, you can directly copy a piece of code to run, the content or there are so many aspects, directly put the code here.
#encoding =GBK
‘‘‘
The code is declared as GBK, because it is running under Windows, and I mentioned the previous article about Python
Code problem,
‘‘‘
x=1# initial one variable x
While x<=9: #判断x小于等于9
y=1# initial one variable y
While y<=x: #确定y的循环次数, less than or equal to X
Print y, ' * ', x, ' = ', y*x, ', #格式化打印输出
y=y+1# counter
print# printing line, preceded by a comma separated, without this line of code is connected to a piece.
Another counter on the x=x+1# perimeter
Raw_input () #让窗口打印玩了不关闭
This article is from the "Sailing It Tribe" blog, make sure to keep this source http://yhitbl.blog.51cto.com/3955073/1543662
Python output multiplication table with while printout