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

How can I create multiple arrays using a for loop or to convert into a 2D array
If you are using numpy and want output like this: array1 = [1, 2, 3] array2 = [3, 2, 1] result = [[3, 2, 1], [6, 4, 2], [9, 6, 3]] you can use np.outer(): np.outer(array1, array2) Edit: Not sure why this was downvoted, but this produces the output u/maybethisonework wants according to their comment above. np.outer([5, 1, 6, 2], [1, 5, 3, 9]) ## [[5,25,15,45], [1,5,3,9], ...] More on reddit.com
🌐 r/learnpython
14
2
May 20, 2020
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
🌐
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.
🌐
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.

🌐
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,...
🌐
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
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.
🌐
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 ...
🌐
Programmingforlovers
programmingforlovers.com › home › chapter 3: discovering a self-replicating automaton with top-down programming › chapter 3 python code alongs › introduction to two-dimensional arrays in python
Introduction to Two-Dimensional Arrays in Python - Programming for Lovers
August 28, 2026 - Python provides a number of ways ... show one. After making a blank list a, we will use a for loop to range over the number of rows that we want to create, and in each one, we create the row, and then append it to a....
🌐
W3Schools
w3schools.com › python › numpy › numpy_array_iterating.asp
NumPy Array Iterating
import numpy as np arr = np.array([1, 2, 3]) for x in np.nditer(arr, flags=['buffered'], op_dtypes=['S']): print(x) Try it Yourself » · We can use filtering and followed by iteration.
🌐
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?
🌐
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.
🌐
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 ·