Below is the implementation:<\/strong><\/p>\n# Give the number of rows as static input and store it in a variable.\r\nnumbOfRows = 8\r\n# Loop from 1 to the number of rows using For Loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from 1 to iterator value of the parent For loop\r\n # using another For loop(Inner For Loop).\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the Newline character after the end of the inner loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\n1 \r\n1 2 \r\n1 2 3 \r\n1 2 3 4 \r\n1 2 3 4 5 \r\n1 2 3 4 5 6 \r\n1 2 3 4 5 6 7 \r\n1 2 3 4 5 6 7 8<\/pre>\nMethod #2: Using For loop (User Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as user input using int(input()) and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For Loop.<\/li>\n
- Loop from 1 to iterator value of the parent For loop using another For loop(Inner For Loop).<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the Newline character after the end of the inner loop.<\/li>\n
- The Exit of the Program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as user input using int(input()) and store it in a variable.\r\nnumbOfRows = int(input('Enter some random number of rows = '))\r\n# Loop from 1 to the number of rows using For Loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from 1 to iterator value of the parent For loop\r\n # using another For loop(Inner For Loop).\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the Newline character after the end of the inner loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\nEnter some random number of rows = 8\r\n1 \r\n1 2 \r\n1 2 3 \r\n1 2 3 4 \r\n1 2 3 4 5 \r\n1 2 3 4 5 6 \r\n1 2 3 4 5 6 7 \r\n1 2 3 4 5 6 7 8<\/pre>\n2) Number Pattern – 2<\/h2>\nMethod #1: Using For loop (Static Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as static input and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For Loop.<\/li>\n
- Loop from 1 to iterator value of the parent For loop using another For loop(Inner For Loop).<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the Newline character after the end of the inner loop.<\/li>\n
- Loop from the number of rows-1 to 1 in decreasing order using For loop.<\/li>\n
- Loop from 1 to iterator value of the parent For loop using another For loop(Inner For Loop).<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the Newline character after the end of the inner loop.<\/li>\n
- The Exit of the Program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as static input and store it in a variable.\r\nnumbOfRows = 6\r\n# Loop from 1 to the number of rows using For Loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from 1 to iterator value of the parent For loop\r\n # using another For loop(Inner For Loop).\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the Newline character after the end of the inner loop.\r\n print()\r\n# Loop from the number of rows-1 to 1 in decreasing order using For loop.\r\nfor m in range(numbOfRows-1, 0, -1):\r\n # Loop from 1 to iterator value of the parent For loop\r\n # using another For loop(Inner For Loop).\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the Newline character after the end of the inner loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\n1 \r\n1 2 \r\n1 2 3 \r\n1 2 3 4 \r\n1 2 3 4 5 \r\n1 2 3 4 5 6 \r\n1 2 3 4 5 \r\n1 2 3 4 \r\n1 2 3 \r\n1 2 \r\n1<\/pre>\nMethod #2: Using For loop (User Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as user input using int(input()) and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For Loop.<\/li>\n
- Loop from 1 to iterator value of the parent For loop using another For loop(Inner For Loop).<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the Newline character after the end of the inner loop.<\/li>\n
- Loop from the number of rows-1 to 1 in decreasing order using For loop.<\/li>\n
- Loop from 1 to iterator value of the parent For loop using another For loop(Inner For Loop).<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the Newline character after the end of the inner loop.<\/li>\n
- The Exit of the Program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as user input using int(input()) and store it in a variable.\r\nnumbOfRows = int(input('Enter some random number of rows = '))\r\n# Loop from 1 to the number of rows using For Loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from 1 to iterator value of the parent For loop\r\n # using another For loop(Inner For Loop).\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the Newline character after the end of the inner loop.\r\n print()\r\n# Loop from the number of rows-1 to 1 in decreasing order using For loop.\r\nfor m in range(numbOfRows-1, 0, -1):\r\n # Loop from 1 to iterator value of the parent For loop\r\n # using another For loop(Inner For Loop).\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the Newline character after the end of the inner loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\nEnter some random number of rows = 8\r\n1 \r\n1 2 \r\n1 2 3 \r\n1 2 3 4 \r\n1 2 3 4 5 \r\n1 2 3 4 5 6 \r\n1 2 3 4 5 6 7 \r\n1 2 3 4 5 6 7 8 \r\n1 2 3 4 5 6 7 \r\n1 2 3 4 5 6 \r\n1 2 3 4 5 \r\n1 2 3 4 \r\n1 2 3 \r\n1 2 \r\n1<\/pre>\n3) Number Pattern – 3<\/h2>\nMethod #1: Using For loop (Static Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as static input and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For loop.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print the iterator value of the parent loop with space in the inner For loop. (This prints the same number parent loop number of times)<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as static input and store it in a variable.\r\nnumbOfRows = 8\r\n# Loop from 1 to the number of rows using For loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from 1 to first loop iterator value using another Nested For loop.\r\n for n in range(1, m+1):\r\n # Print the iterator value of the nested loop with space in the inner For loop.\r\n # (This prints the same number parent loop number of times)\r\n print(m, end=' ')\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\n1 \r\n2 2 \r\n3 3 3 \r\n4 4 4 4 \r\n5 5 5 5 5 \r\n6 6 6 6 6 6 \r\n7 7 7 7 7 7 7 \r\n8 8 8 8 8 8 8 8<\/pre>\nMethod #2: Using For loop (User Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as user input using int(input()) and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For loop.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print the iterator value of the parent loop with space in the inner For loop. (This prints the same number parent loop number of times)<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as user input using int(input()) and store it in a variable.\r\nnumbOfRows = int(input('Enter some random number of rows = '))\r\n# Loop from 1 to the number of rows using For loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from 1 to first loop iterator value using another Nested For loop.\r\n for n in range(1, m+1):\r\n # Print the iterator value of the nested loop with space in the inner For loop.\r\n # (This prints the same number parent loop number of times)\r\n print(m, end=' ')\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\nEnter some random number of rows = 6\r\n1 \r\n2 2 \r\n3 3 3 \r\n4 4 4 4 \r\n5 5 5 5 5 \r\n6 6 6 6 6 6<\/pre>\n4) Number Pattern – 4<\/h2>\nMethod #1: Using For loop (Static Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as static input and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For loop.<\/li>\n
- Loop from the number of rows to iterator value>=m in decreasing order using another For Loop(Inner For loop) where m is the iterator value of the parent For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the Newline character after the end of the inner loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as static input and store it in a variable.\r\nnumbOfRows = 10\r\n# Loop from 1 to the number of rows using For Loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from the number of rows to iterator value>=m in decreasing order\r\n # using another For Loop(Inner For loop)\r\n # where m is the iterator value of the parent For loop.\r\n for n in range(numbOfRows, m-1, -1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the Newline character after the end of the inner loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\n10 9 8 7 6 5 4 3 2 1 \r\n10 9 8 7 6 5 4 3 2 \r\n10 9 8 7 6 5 4 3 \r\n10 9 8 7 6 5 4 \r\n10 9 8 7 6 5 \r\n10 9 8 7 6 \r\n10 9 8 7 \r\n10 9 8 \r\n10 9 \r\n10<\/pre>\nMethod #2: Using For loop (User Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as user input using int(input()) and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For loop.<\/li>\n
- Loop from the number of rows to m in decreasing order using another For Loop(Inner For loop) where m is the iterator value of the parent For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the Newline character after the end of the inner loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as user input using int(input()) and store it in a variable.\r\nnumbOfRows = int(input('Enter some random number of rows = '))\r\n# Loop from 1 to the number of rows using For Loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from the number of rows to iterator value>=m in decreasing order\r\n # using another For Loop(Inner For loop)\r\n # where m is the iterator value of the parent For loop.\r\n for n in range(numbOfRows, m-1, -1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the Newline character after the end of the inner loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\nEnter some random number of rows = 9\r\n9 8 7 6 5 4 3 2 1 \r\n9 8 7 6 5 4 3 2 \r\n9 8 7 6 5 4 3 \r\n9 8 7 6 5 4 \r\n9 8 7 6 5 \r\n9 8 7 6 \r\n9 8 7 \r\n9 8 \r\n9<\/pre>\n5) Number Pattern – 5<\/h2>\nMethod #1: Using For loop (Static Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as static input and store it in a variable.<\/li>\n
- Loop from the number of rows to 1(included) in decreasing order.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as static input and store it in a variable.\r\nnumbOfRows = 9\r\n# Loop from the number of rows to 1(included) in decreasing order.\r\nfor m in range(numbOfRows, 0, -1):\r\n # Loop from 1 to first loop iterator value using another Nested For loop.\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\n1 2 3 4 5 6 7 8 9 \r\n1 2 3 4 5 6 7 8 \r\n1 2 3 4 5 6 7 \r\n1 2 3 4 5 6 \r\n1 2 3 4 5 \r\n1 2 3 4 \r\n1 2 3 \r\n1 2 \r\n1<\/pre>\nMethod #2: Using For loop (User Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as user input using int(input()) and store it in a variable.<\/li>\n
- Loop from the number of rows to 1(included) in decreasing order.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as user input using int(input()) and store it in a variable.\r\nnumbOfRows = int(input('Enter some random number of rows = '))\r\n# Loop from the number of rows to 1(included) in decreasing order.\r\nfor m in range(numbOfRows, 0, -1):\r\n # Loop from 1 to first loop iterator value using another Nested For loop.\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\nEnter some random number of rows = 5\r\n1 2 3 4 5 \r\n1 2 3 4 \r\n1 2 3 \r\n1 2 \r\n1<\/pre>\n6) Number Pattern – 6<\/h2>\nMethod #1: Using For loop (Static Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as static input and store it in a variable.<\/li>\n
- Loop from the number of rows to 1(included) in decreasing order using For loop.<\/li>\n
- Loop from iterator value of the parent For loop to 1(included) in decreasing order using another Nested For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as static input and store it in a variable.\r\nnumbOfRows = 11\r\n# Loop\u00a0from\u00a0the\u00a0number\u00a0of\u00a0rows\u00a0to\u00a01(included)\u00a0in\u00a0decreasing\u00a0order\u00a0using\u00a0For\u00a0loop.\r\nfor m in range(numbOfRows, 0, -1):\r\n # Loop from iterator value of the parent For loop to 1(included)\r\n # in decreasing order using another Nested For loop.\r\n for n in range(m, 0, -1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\n11 10 9 8 7 6 5 4 3 2 1 \r\n10 9 8 7 6 5 4 3 2 1 \r\n9 8 7 6 5 4 3 2 1 \r\n8 7 6 5 4 3 2 1 \r\n7 6 5 4 3 2 1 \r\n6 5 4 3 2 1 \r\n5 4 3 2 1 \r\n4 3 2 1 \r\n3 2 1 \r\n2 1 \r\n1<\/pre>\nMethod #2: Using For loop (User Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as user input using int(input()) and store it in a variable.<\/li>\n
- Loop from the number of rows to 1(included) in decreasing order using For loop.<\/li>\n
- Loop from iterator value of the parent For loop to 1(included) in decreasing order using another Nested For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as user input using int(input()) and store it in a variable.\r\nnumbOfRows = int(input('Enter some random number of rows = '))\r\n# Loop\u00a0from\u00a0the\u00a0number\u00a0of\u00a0rows\u00a0to\u00a01(included)\u00a0in\u00a0decreasing\u00a0order\u00a0using\u00a0For\u00a0loop.\r\nfor m in range(numbOfRows, 0, -1):\r\n # Loop from iterator value of the parent For loop to 1(included)\r\n # in decreasing order using another Nested For loop.\r\n for n in range(m, 0, -1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\nEnter some random number of rows = 8\r\n8 7 6 5 4 3 2 1 \r\n7 6 5 4 3 2 1 \r\n6 5 4 3 2 1 \r\n5 4 3 2 1 \r\n4 3 2 1 \r\n3 2 1 \r\n2 1 \r\n1<\/pre>\n7) Number Pattern – 7<\/h2>\nMethod #1: Using For loop (Static Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as static input and store it in a variable.<\/li>\n
- Loop from the number of rows to 1(included) in decreasing order using For loop.<\/li>\n
- Loop from the number of rows to m in decreasing order using another For Loop(Inner For loop) where m is the iterator value of the parent For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as static input and store it in a variable.\r\nnumbOfRows =6\r\n# Loop from the number of rows to 1(included) in decreasing order.\r\nfor m in range(numbOfRows, 0, -1):\r\n # Loop from the number of rows to m in decreasing order using\r\n # another For Loop(Inner For loop)\r\n # where m is the iterator value of the parent For loop.\r\n for n in range(numbOfRows, m-1, -1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\n6 \r\n6 5 \r\n6 5 4 \r\n6 5 4 3 \r\n6 5 4 3 2 \r\n6 5 4 3 2 1<\/pre>\nMethod #2: Using For loop (User Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as user input using int(input()) and store it in a variable.<\/li>\n
- Loop from the number of rows to 1(included) in decreasing order using For loop.<\/li>\n
- Loop from iterator value of the parent For loop to 1(included) in decreasing order using another Nested For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\nOutput:<\/strong><\/p>\n# Give the number of rows as user input using int(input()) and store it in a variable.\r\nnumbOfRows = int(input('Enter some random number of rows = '))\r\n# Loop from the number of rows to 1(included) in decreasing order using For loop.\r\nfor m in range(numbOfRows, 0, -1):\r\n # Loop from the number of rows to m in decreasing order using\r\n # another For Loop(Inner For loop)\r\n # where m is the iterator value of the parent For loop.\r\n for n in range(numbOfRows, m-1, -1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\nEnter some random number of rows = 8\r\n8 \r\n8 7 \r\n8 7 6 \r\n8 7 6 5 \r\n8 7 6 5 4 \r\n8 7 6 5 4 3 \r\n8 7 6 5 4 3 2 \r\n8 7 6 5 4 3 2 1<\/pre>\n8) Number Pattern – 8<\/h2>\nMethod #1: Using For loop (Static Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as static input and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For loop.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Loop from iterator value of the parent For loop -1 to 1(included) in decreasing order using another For loop(Inner For Loop).<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as static input and store it in a variable.\r\nnumbOfRows = 9\r\n# Loop from 1 to the number of rows using For Loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from 1 to iterator value of the parent For loop\r\n # using another For loop(Inner For Loop).\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n '''Loop from iterator value of the parent For loop -1 to 1(included) \r\n in decreasing order using another For loop(Inner For Loop). '''\r\n for n in range(m-1, 0, -1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n\r\n # Print the Newline character after the end of the inner loop.\r\n print(\r\n<\/pre>\nOutput:<\/strong><\/p>\n1 \r\n1 2 1 \r\n1 2 3 2 1 \r\n1 2 3 4 3 2 1 \r\n1 2 3 4 5 4 3 2 1 \r\n1 2 3 4 5 6 5 4 3 2 1 \r\n1 2 3 4 5 6 7 6 5 4 3 2 1 \r\n1 2 3 4 5 6 7 8 7 6 5 4 3 2 1 \r\n1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1<\/pre>\nMethod #2: Using For loop (User Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as user input using int(input()) and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For loop.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Loop from iterator value of the parent For loop -1 to 1(included) in decreasing order using another For loop(Inner For Loop).<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as user input using int(input()) and store it in a variable.\r\nnumbOfRows = int(input('Enter some random number of rows = '))\r\n# Loop from 1 to the number of rows using For Loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from 1 to iterator value of the parent For loop\r\n # using another For loop(Inner For Loop).\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n '''Loop from iterator value of the parent For loop -1 to 1(included) \r\n in decreasing order using another For loop(Inner For Loop). '''\r\n for n in range(m-1, 0, -1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n\r\n # Print the Newline character after the end of the inner loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\nEnter some random number of rows = 10\r\n1 \r\n1 2 1 \r\n1 2 3 2 1 \r\n1 2 3 4 3 2 1 \r\n1 2 3 4 5 4 3 2 1 \r\n1 2 3 4 5 6 5 4 3 2 1 \r\n1 2 3 4 5 6 7 6 5 4 3 2 1 \r\n1 2 3 4 5 6 7 8 7 6 5 4 3 2 1 \r\n1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1 \r\n1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1<\/pre>\n9) Number Pattern – 9<\/h2>\nMethod #1: Using For loop (Static Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as static input and store it in a variable.<\/li>\n
- Loop from the number of rows to 1(included) in decreasing order.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- Loop from 2 to the number of rows using For loop.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as static input and store it in a variable.\r\nnumbOfRows = 8\r\n# Loop from the number of rows to 1(included) in decreasing order.\r\nfor m in range(numbOfRows, 0, -1):\r\n # Loop from 1 to first loop iterator value using another Nested For loop.\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n# Loop from 2 to the number of rows using For Loop.\r\nfor m in range(2, numbOfRows+1):\r\n # Loop from 1 to iterator value of the parent For loop\r\n # using another For loop(Inner For Loop).\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the Newline character after the end of the inner loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\n1 2 3 4 5 6 7 8 \r\n1 2 3 4 5 6 7 \r\n1 2 3 4 5 6 \r\n1 2 3 4 5 \r\n1 2 3 4 \r\n1 2 3 \r\n1 2 \r\n1 \r\n1 2 \r\n1 2 3 \r\n1 2 3 4 \r\n1 2 3 4 5 \r\n1 2 3 4 5 6 \r\n1 2 3 4 5 6 7 \r\n1 2 3 4 5 6 7 8<\/pre>\nMethod #2: Using For loop (User Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as user input using int(input()) and store it in a variable.<\/li>\n
- Loop from the number of rows to 1(included) in decreasing order.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- Loop from 2 to the number of rows using For loop.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as user input using int(input()) and store it in a variable.\r\nnumbOfRows = int(input('Enter some random number of rows = '))\r\n# Loop from the number of rows to 1(included) in decreasing order.\r\nfor m in range(numbOfRows, 0, -1):\r\n # Loop from 1 to first loop iterator value using another Nested For loop.\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n# Loop from 2 to the number of rows using For Loop.\r\nfor m in range(2, numbOfRows+1):\r\n # Loop from 1 to iterator value of the parent For loop\r\n # using another For loop(Inner For Loop).\r\n for n in range(1, m+1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the Newline character after the end of the inner loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\nEnter some random number of rows = 11\r\n1 2 3 4 5 6 7 8 9 10 11 \r\n1 2 3 4 5 6 7 8 9 10 \r\n1 2 3 4 5 6 7 8 9 \r\n1 2 3 4 5 6 7 8 \r\n1 2 3 4 5 6 7 \r\n1 2 3 4 5 6 \r\n1 2 3 4 5 \r\n1 2 3 4 \r\n1 2 3 \r\n1 2 \r\n1 \r\n1 2 \r\n1 2 3 \r\n1 2 3 4 \r\n1 2 3 4 5 \r\n1 2 3 4 5 6 \r\n1 2 3 4 5 6 7 \r\n1 2 3 4 5 6 7 8 \r\n1 2 3 4 5 6 7 8 9 \r\n1 2 3 4 5 6 7 8 9 10 \r\n1 2 3 4 5 6 7 8 9 10 11<\/pre>\n10) Number Pattern – 10<\/h2>\nMethod #1: Using For loop (Static Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as static input and store it in a variable.<\/li>\n
- Loop from the 1 to the number of rows using For loop.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print Two spaces.<\/li>\n
- Loop from the first loop iterator value to the number of rows(included) using Another For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- Loop from the number of rows -1 to 1(included) in decreasing order using For loop.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print Two spaces.<\/li>\n
- <\/li>\n
- Loop from the first loop iterator value to the number of rows(included) using Another For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as static input and store it in a variable.\r\nnumbOfRows = 8\r\n# Loop from 1 to the number of rows using For loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from 1 to first loop iterator value using another Nested For loop.\r\n for n in range(1, m):\r\n # Print Two spaces.\r\n print(' ', end=' ')\r\n # Loop from the first loop iterator value to the number of rows(included)\r\n # using Another For loop.\r\n for n in range(m, numbOfRows+1):\r\n print(n, end=' ')\r\n\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n\r\n# Loop from the number of rows -1 to 1(included) in decreasing order using For loop.\r\nfor m in range(numbOfRows-1, 0, -1):\r\n # Loop from 1 to first loop iterator value using another Nested For loop.\r\n for n in range(1, m):\r\n # Print\u00a0Two\u00a0spaces.\r\n print(' ', end=' ')\r\n # Loop from the first loop iterator value to the number of rows(included)\r\n # using Another For loop.\r\n for n in range(m, numbOfRows+1):\r\n print(n, end=' ')\r\n\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\n1 2 3 4 5 6 7 8 \r\n 2 3 4 5 6 7 8 \r\n 3 4 5 6 7 8 \r\n 4 5 6 7 8 \r\n 5 6 7 8 \r\n 6 7 8 \r\n 7 8 \r\n 8 \r\n 7 8 \r\n 6 7 8 \r\n 5 6 7 8 \r\n 4 5 6 7 8 \r\n 3 4 5 6 7 8 \r\n 2 3 4 5 6 7 8 \r\n1 2 3 4 5 6 7 8<\/pre>\nMethod #2: Using For loop (User Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as user input using int(input()) and store it in a variable.<\/li>\n
- Loop from the 1 to the number of rows using For loop.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print Two spaces.<\/li>\n
- Loop from the first loop iterator value to the number of rows(included) using Another For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- Loop from the number of rows -1 to 1(included) in decreasing order using For loop.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Print Two spaces.<\/li>\n
- Loop from the first loop iterator value to the number of rows(included) using Another For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:
\n<\/strong><\/p>\n# Give the number of rows as user input using int(input()) and store it in a variable.\r\nnumbOfRows = int(input('Enter some random number of rows = '))\r\n# Loop from 1 to the number of rows using For loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from 1 to first loop iterator value using another Nested For loop.\r\n for n in range(1, m):\r\n # Print Two spaces.\r\n print(' ', end=' ')\r\n # Loop from the first loop iterator value to the number of rows(included)\r\n # using Another For loop.\r\n for n in range(m, numbOfRows+1):\r\n print(n, end=' ')\r\n\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n\r\n# Loop from the number of rows -1 to 1(included) in decreasing order using For loop.\r\nfor m in range(numbOfRows-1, 0, -1):\r\n # Loop from 1 to first loop iterator value using another Nested For loop.\r\n for n in range(1, m):\r\n # Print\u00a0Two\u00a0spaces.\r\n print(' ', end=' ')\r\n # Loop from the first loop iterator value to the number of rows(included)\r\n # using Another For loop.\r\n for n in range(m, numbOfRows+1):\r\n print(n, end=' ')\r\n\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\nEnter some random number of rows = 8\r\n1 2 3 4 5 6 7 8 \r\n 2 3 4 5 6 7 8 \r\n 3 4 5 6 7 8 \r\n 4 5 6 7 8 \r\n 5 6 7 8 \r\n 6 7 8 \r\n 7 8 \r\n 8 \r\n 7 8 \r\n 6 7 8 \r\n 5 6 7 8 \r\n 4 5 6 7 8 \r\n 3 4 5 6 7 8 \r\n 2 3 4 5 6 7 8 \r\n1 2 3 4 5 6 7 8<\/pre>\n11) Number Pattern – 11<\/h2>\nMethod #1: Using For loop (Static Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as static input and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For loop.<\/li>\n
- Loop from iterator value of the parent For loop to 1(included) in decreasing order using another Nested For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as static input and store it in a variable.\r\nnumbOfRows = 10\r\n# Loop from 1 to the number of rows using For Loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from iterator value of the parent For loop to 1(included)\r\n # in decreasing order\r\n # using another Nested For loop.\r\n for n in range(m, 0, -1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the Newline character after the end of the inner loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\n1 \r\n2 1 \r\n3 2 1 \r\n4 3 2 1 \r\n5 4 3 2 1 \r\n6 5 4 3 2 1 \r\n7 6 5 4 3 2 1 \r\n8 7 6 5 4 3 2 1 \r\n9 8 7 6 5 4 3 2 1 \r\n10 9 8 7 6 5 4 3 2 1<\/pre>\nMethod #2: Using For loop (User Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as user input using int(input()) and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For loop.<\/li>\n
- Loop from iterator value of the parent For loop to 1(included) in decreasing order using another Nested For loop.<\/li>\n
- Print the iterator value of the inner For loop.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as user input using int(input()) and store it in a variable.\r\nnumbOfRows = int(input('Enter some random number of rows = '))\r\n# Loop from 1 to the number of rows using For Loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from iterator value of the parent For loop to 1(included)\r\n # in decreasing order\r\n # using another Nested For loop.\r\n for n in range(m, 0, -1):\r\n # Print the iterator value of the inner For loop.\r\n print(n, end=' ')\r\n # Print the Newline character after the end of the inner loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\nEnter some random number of rows = 7\r\n1 \r\n2 1 \r\n3 2 1 \r\n4 3 2 1 \r\n5 4 3 2 1 \r\n6 5 4 3 2 1 \r\n7 6 5 4 3 2 1<\/pre>\n12) Number Pattern – 12<\/h2>\nMethod #1: Using For loop (Static Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as static input and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For loop.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Check if the iterator value of the inner For loop is divisible by 2 or not using the If statement.<\/li>\n
- If it is true then print 0.<\/li>\n
- Else print 1.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as static input and store it in a variable.\r\nnumbOfRows = 8\r\n# Loop from 1 to the number of rows using For loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from 1 to first loop iterator value using another Nested For loop.\r\n for n in range(1, m+1):\r\n # Check if the iterator value of the inner For loop is divisible by 2\r\n # or not using the If statement.\r\n if(n % 2 == 0):\r\n # If it is true then print 0.\r\n print('0', end='')\r\n # Else print 1.\r\n else:\r\n print('1', end='')\r\n\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\n1\r\n10\r\n101\r\n1010\r\n10101\r\n101010\r\n1010101\r\n10101010<\/pre>\nMethod #2: Using For loop (User Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as user input using int(input()) and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For loop.<\/li>\n
- Loop from 1 to first loop iterator value using another Nested For loop.<\/li>\n
- Check if the iterator value of the inner For loop is divisible by 2 or not using the If statement.<\/li>\n
- If it is true then print 0.<\/li>\n
- Else print 1.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as user input using int(input()) and store it in a variable.\r\nnumbOfRows = int(input('Enter some random number of rows = '))\r\n# Loop from 1 to the number of rows using For loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from 1 to first loop iterator value using another Nested For loop.\r\n for n in range(1, m+1):\r\n # Check if the iterator value of the inner For loop is divisible by 2\r\n # or not using the If statement.\r\n if(n % 2 == 0):\r\n # If it is true then print 0.\r\n print('0', end='')\r\n # Else print 1.\r\n else:\r\n print('1', end='')\r\n\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\nEnter some random number of rows = 11\r\n1\r\n10\r\n101\r\n1010\r\n10101\r\n101010\r\n1010101\r\n10101010\r\n101010101\r\n1010101010\r\n10101010101<\/pre>\n13) Number Pattern – 13<\/h2>\nMethod #1: Using For loop (Static Input)<\/h3>\n
Approach:<\/strong><\/p>\n\n- Give the number of rows as static input and store it in a variable.<\/li>\n
- Loop from 1 to the number of rows using For loop.<\/li>\n
- Loop from 1 to the number of rows using another Nested For loop.<\/li>\n
- Check if the iterator value of the inner For loop is equal to the iterator value of the parent For loop or not using the If statement.<\/li>\n
- If it is true then print the iterator value of the inner For Loop.<\/li>\n
- Else print 0.<\/li>\n
- Print the newline character after ending of inner For loop.<\/li>\n
- The Exit of the program.<\/li>\n<\/ul>\n
Below is the implementation:<\/strong><\/p>\n# Give the number of rows as static input and store it in a variable.\r\nnumbOfRows = 8\r\n# Loop from 1 to the number of rows using For loop.\r\nfor m in range(1, numbOfRows+1):\r\n # Loop from 1 to the number of rows using another Nested For loop.\r\n for n in range(1, numbOfRows+1):\r\n # Check if the iterator value of the inner For loop is equal to the iterator value of the parent\r\n # For loop or not using the If statement.\r\n if(n == m):\r\n # If it is true then print n.\r\n print(n, end=' ')\r\n # Else print 0.\r\n else:\r\n print('0', end=' ')\r\n\r\n # Print the newline character after ending of inner For loop.\r\n print()\r\n<\/pre>\nOutput:<\/strong><\/p>\n1 0 0 0 0 0 0 0 \r\n0 2 0 0 0 0 0 0 \r\n0 0 3 0 0 0 0 0 \r\n0 0 0 4 0 0 0 0 \r\n0 0 0 0 5 0 0 0 \r\n0 0 0 0 0 6 0 0 \r\n0 0 0 0 0 0 7 0 \r\n0 0 0 0 0 0 0 8<\/pre>\nMethod #2: Using For loop (User Input)<\/h3>\n