跳到主要內容

發表文章

目前顯示的是 9月, 2017的文章

[Python] For Loop for 9x9 Multiplication Table

 "Just Share and Record my learning track" #For loop to show 9 X 9 matrix i=1 j=1 for i in range(1,10,1): for j in range (1,10,1): print (i*j, end= " ") print() For Loop Example in One line     Check the following blog to know it. http://pythonnote.blogspot.tw/2010/01/blog-post.html

[Python] While Loop for 9x9 Multiplication Table

  "Just Share and Record my learning track" #While Loop to display 9 x 9 matrix # Example 1 with i, j variables i = 1 j = 1 while i <= 9: while j <= 9: print(i * j, end = " ") j += 1 i += 1 j = 1 print() # Example 2 with x, y variables x=1 y=1 while x<=9: while y<=9: print(x*y, end=' ') y+=1 x+=1 y=1 print() # Error IndentationError: unexpected indent #Example 2 failed because of print() alignment problem