You can try this:

import numpy as np
listvals = []
for i in range(10):
    listvals.append((xc, yc))
mat_vals = np.vstack(listvals)

This will output an ndarray like this:

[[ 2  0]
 [ 3  1]
 [ 4  2]
 [ 5  3]
 [ 6  4]
 [ 7  5]
 [ 8  6]
 [ 9  7]
 [10  8]
 [11  9]]

Or this maybe is better:

import numpy as np
list_xc = []
list_yc = []
for i in np.arange(10): 
    list_xc.append(xc)
    list_yc.append(yc)
mat_xc = np.asarray(list_xc)
mat_yc = np.asarray(list_yc)
mat_f = np.column_stack((mat_xc, mat_yc))
Answer from Litwos on Stack Overflow
🌐
Snakify
snakify.org › two-dimensional lists (arrays)
Two-dimensional lists (arrays) - Learn Python 3 - Snakify
We have already tried to explain that a for-loop variable in Python can iterate not only over a range(), but generally over all the elements of any sequence. Sequences in Python are lists and strings (and some other objects that we haven't met yet). Look how you can print a two-dimensional array, using this handy feature of loop for:
Discussions

loops - Iterating over a 2 dimensional python list - Stack Overflow
I have created a 2 dimension array like: rows =3 columns= 2 mylist = [[0 for x in range(columns)] for x in range(rows)] for i in range(rows): for j in range(columns): mylist[i][j] = '% More on stackoverflow.com
🌐 stackoverflow.com
python - Write a 2-d array in a for-loop - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work More on stackoverflow.com
🌐 stackoverflow.com
python - Create 2D numpy array through nested loop - Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most. Learn more about Collectives ... I would like to create a 2D array using nested loop. What is the problem with this code? import numpy b = np.array([]) for i in range(2): for j in range(5): b[i][j]=i+j print(b) More on stackoverflow.com
🌐 stackoverflow.com
How to create 2d NumPy array with for loop [Python] - Stack Overflow
Get a problem There is a double cycle, on the secondary loop we get an array of 10 elements. Then, after each cycle (first), you need to add these elements to the array. At the output, you need to ... More on stackoverflow.com
🌐 stackoverflow.com
May 17, 2018
🌐
Reddit
reddit.com › r/learnpython › how can i create multiple arrays using a for loop or to convert into a 2d array
r/learnpython on Reddit: How can I create multiple arrays using a for loop or to convert into a 2D array
May 20, 2020 -

I have this two arrays

array1 = [1. 0.91 0.8 0.68 0.61 0.57 0.52 0.46 0.39 0.3 ]

array2 = [188.38188649 201.69718164 210.51306563 221.65195842 229.91542541 238.11787625 257.072488 ]

I need to multiple the second array by each value in the first one. I have tried using a for loop like this

for i in range (array1):
    new_array = array2 * array1[i]

But it shows me this error

TypeError: only integer scalar arrays can be converted to a scalar index

Any help is appreciated, thank you.

🌐
TutorialsPoint
tutorialspoint.com › python_data_structure › python_2darray.htm
Python - 2-D Array
To print out the entire two dimensional array we can use python for loop as shown below.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-using-2d-arrays-lists-the-right-way
Using 2D arrays/lists in Python - GeeksforGeeks
Although Python does not have a native 1D array type, lists serve the same purpose efficiently. Manually initializing and populating a list without using any advanced features or constructs in Python is known as creating a 1D list using "Naive Methods". ... Explanation: [0] * N creates a list of size N. ... Explanation: range(N) controls list length. A 2D list represents data in rows and columns.
Published: December 20, 2025
🌐
Stack Overflow
stackoverflow.com › questions › 16548668 › iterating-over-a-2-dimensional-python-list
loops - Iterating over a 2 dimensional python list - Stack Overflow
I have created a 2 dimension array like: rows =3 columns= 2 mylist = [[0 for x in range(columns)] for x in range(rows)] for i in range(rows): for j in range(columns): mylist[i][j] = '%...
🌐
Stack Overflow
stackoverflow.com › questions › 46159488 › write-a-2-d-array-in-a-for-loop
python - Write a 2-d array in a for-loop - Stack Overflow
I want to create 2 arrays from the following for-loop: with open('y.txt', 'w') as f: for j in range (1, 3): xN = 0.5 + 0.5*random.uniform(0, 1) r = 3.8 + 0.15*random.uniform(0,...
Find elsewhere
🌐
Finxter
blog.finxter.com › home › learn python blog › how to create a two dimensional array in python?
How To Create a Two Dimensional Array in Python? - Be on the Right Side of Change
June 11, 2022 - Finally, we print the array with the help of a for loop by simply displaying the keys of the dictionary which are storing the lists, i.e., the individual rows of the 2D array. The most convenient way of working with arrays in Python is to use Python’s Numpy library.
🌐
Scaler
scaler.com › home › topics › 2d array in python
2D Array in Python | Python Two-Dimensional Array - Scaler Topics
May 25, 2026 - Let’s see some examples of how elements are traversed in a 2D array in python. In this example, we traverse the array named arr by using two for loops.
🌐
YouTube
youtube.com › watch
2.3.2 - Using a loop to create a 2D array (Python) - YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
Published: January 22, 2019
🌐
Guru99
guru99.com › home › python › python 2d arrays: two-dimensional list examples
Python 2D Arrays: Two-Dimensional List Examples
October 7, 2026 - Use nested for loops: the outer loop iterates over each row, and the inner loop iterates over the columns inside that row. This lets you read or update every element position by position. 🤖 How can AI help me work with 2D arrays in Python?
🌐
iO Flood
ioflood.com › blog › python-2d-array
Python 2D Array with Lists | Guide (With Examples)
February 10, 2024 - Here’s an example: for row in array: for elem in row: print(elem, end=' ') print() # Output: # 10 2 3 # 4 5 6 # 7 8 9 · In this example, we printed each element in the 2D array, with each row’s elements separated by a space and each row ...
🌐
CodeSignal
codesignal.com › learn › courses › multidimensional-arrays-and-their-traversal-in-python › lessons › exploring-the-dimensions-a-beginners-guide-to-multidimensional-arrays-in-python
Exploring the Dimensions: A Beginner's Guide to Multidimensional Arrays in Python | CodeSignal Learn
Python · array = [["Apt 101", "Apt 102", "Apt 103"], ["Apt 201", "Exit Floor", "Apt 203"], ["Apt 301", "Apt 302", "Apt 303"]] # Loop through 2D array for floor in array: for unit in floor: print(unit, end =', ') print() """ Prints: Apt 101, Apt 102, Apt 103, Apt 201, Exit Floor, Apt 203, Apt 301, Apt 302, Apt 303, """ Python ·
🌐
Upgrad
upgrad.com › home › tutorials › software & tech › 2d array in python
Comprehensive Guide to 2D Arrays in Python: Creation, Access, and Use
November 11, 2024 - Ensure that your code accounts for edge cases, such as the first and last rows and columns. ... # Check if a specific element is within bounds if 0 <= row < num_rows and 0 <= col < num_cols: value = array[row][col] else: print("Element is out of bounds.") ... 2d list Python comprehension is a concise and readable way to create and modify 2D arrays.
🌐
YouTube
youtube.com › geeky shows
Accessing Numpy Two Dimensional Array using for Loop in Python (Hindi) - YouTube
Accessing Numpy Two Dimensional Array using for Loop in PythonCore Python Playlist: https://www.youtube.com/playlist?list=PLbGui_ZYuhigZkqrHbI_ZkPBrIr5Rsd5L ...
Published: September 30, 2019
Views: 17K
🌐
Google
sites.google.com › rgc.aberdeen.sch.uk › rgcahcomputingrevision › software-design › data-types-and-structures › 2d-arrays
Advanced Higher Computing Revision - 2D Arrays
When declaring a 2 dimensional (2D) array we specify the rows and columns · Python treats this as a list within a list. You will notice that we have initialised each element in the array with a value of 0. This would create a 2D array called my2dArray with 3 rows and 8 columns.