About 890,000 results
Open links in new tab
  1. python - Create a 2D list out of 1D list - Stack Overflow

    I am a bit new to Python and I want to convert a 1D list to a 2D list, given the width and length of this matrix. Say I have a list=[0,1,2,3] and I want to make a 2 by 2 matrix of this list. How can I …

  2. Creating a one-dimensional NumPy array - GeeksforGeeks

    Jan 27, 2025 · We can create a 1-D array in NumPy using the array() function, which converts a Python list or iterable object. Python import numpy as np # Create a one-dimensional array …

  3. python: create a new 1D list with values from 2 different lists:

    May 30, 2018 · What I want is to create a new list that contain the values [0,1,2,3,4] by merging list1 and list 2 together. But the code below doesn't work and I am not really sure how I should …

  4. python: check if list is multidimensional or one dimensional

    Apr 13, 2013 · I am currently programing in python and I created a method that inputs list from the user, without knowing whether he is multidimensional or one dimensional. how do I check? …

  5. Python One Dimensional Array (List) Program - CodesCracker

    This article contains multiple programs in Python, on one dimensional array, basically one dimensional list. Here is the simplest program on one dimensional array in Python: arr = [1, 2, …

  6. Convert 1D list to 2D list of variable length- Python

    Feb 1, 2025 · When converting a 1D list to a 2D list of variable lengths, islice from itertools module offers an efficient way to slice the list into chunks without storing the entire list in memory. It …

  7. Array creation — NumPy v2.2 Manual

    The 1D array creation functions e.g. numpy.linspace and numpy.arange generally need at least two inputs, start and stop. numpy.arange creates arrays with regularly incrementing values. …

  8. Python | Using 2D arrays/lists the right way - GeeksforGeeks

    Jun 20, 2024 · Python lists are dynamic and versatile, making them an excellent choice for representing 1D arrays. Let's start by looking at common ways of creating a 1d array of size N …

  9. A Guide to Flatten List & List of Lists in Python - Techgeekbuzz

    Feb 10, 2025 · This tutorial will help you learn how to flatten a Python 2D or multi-dimensional list into a 1D list (flatten a list of lists).

  10. Scenario-Based Coding Problems on 1D List in Python

    Feb 8, 2025 · In Python, we use lists for 1D arrays, and they are a powerful tool for handling ordered collections of data. Let’s look into some fun and engaging scenarios where you’ll use …

  11. Some results have been removed
Refresh