DeveloperBreeze

Create a NumPy 1D Array

The following Python code demonstrates how to create a one-dimensional array using NumPy:

import numpy as np

# Create a 1D array
arr = np.array([1, 2, 3, 4, 5])
print(arr)

Related Posts

More content you might like

Code
python

Generate Fibonacci Sequence

def fibonacci(n):
    if n <= 1:
        return n
    else:
        return fibonacci(n-1) + fibonacci(n-2)

result = [fibonacci(i) for i in range(10)]
print('Fibonacci Sequence:', result)

Jan 26, 2024
Read More
Code
python

Sort a List

No preview available for this content.

Jan 26, 2024
Read More
Code
python

Calculate Sum of Numbers in a List Using sum() Function

No preview available for this content.

Jan 26, 2024
Read More
Code
python

Generate List of Even Numbers Using List Comprehension

No preview available for this content.

Jan 26, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Be the first to share your thoughts!