One way to loop through a two-dimensional array and create a new one with numbers over 10 is to use nested loops and conditional statements. Here's an example code:
main.py690 chars26 lines
In this example, we first define the original two-dimensional array. Then, we define an empty new array. We use a nested loop to loop through each row in the original array and each element in each row. If an element is greater than 10, we add it to the new row. Otherwise, we add 0 to the new row. Finally, we add the new row to the new array. We print both the original and new arrays at the end.
gistlibby LogSnag