跳到主要內容

[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




留言

這個網誌中的熱門文章

[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

Demo MongoDB function in Raspberry Pi 3 with Node Red

Free source is every where on the internet especially for Linux system. Today, I wants to share how to run MongoDB on Raspberry Pi 3 and then use Node Red to get data and send data back to the database we just created. By doing this, you can just spend little money on Raspberry Pi 3 hardware and then you could start your way to build a data collection site with the latest flow-based programming tool, Node Red. Prepare  1. Refer to the detail and great instruction already post by http://recipes.item.ntnu.no/using-node-red-mongodb-to-gather-and-publish-data-on-a-raspberry-pi/ 2. Use SSH to log in Raspberry Pi 3 and start Node Red 3. Enter URL to Node Red at port 1880 and start draw the flow MonogoDB 1. Drag MongoDB block and Assign the Server IP address and DB name 2. Assign the Collection and Define operation as "Insert" 3. After Deploy, Go to Node Red UI and Test the switch function 4. Use SSH command to enter mongoDB shell and "use myDB"

PCI-1752U IDO Function Test with DAQNavi

When you have PIC-1752U IDO card function test request, you may try the following step to have a simple and quick function test. Prepare items:  HW: Windows Platform to insert PCI-1752U  SW: DAQNavi + PCI-1752U Driver Simple Steps: 1. Install and Open DAQNavi 2. Click Device Test Tap and select output 3. Fill in FF in textbox to turn on all output 4. Select Support Device to check Signal Connection 5. Wire PCI-1752U thru 100 pin SCSI cable to ADAM-39100, and use LED board to test the output function Finally, you could jump back to Device Test Page, and you may find the bug - all output channel show "turn off", but they are actually turning on. This may due to software bug not keeping DO status when switching pages.