Python lists can hold rows of numeric data, but NumPy calculations use homogeneous arrays whose elements share one data type. Converting the input at a clear boundary makes the resulting dimensions and storage type explicit before later calculations depend on them.

The np.array() constructor accepts a nested Python sequence and maps each inner list to a row. Setting dtype=np.float64 during construction keeps decimal values in a known floating-point representation rather than leaving type selection to inference.

Shape and dtype deserve separate checks because a valid array can still be oriented or typed differently from the calculation that consumes it. Assertions make either mismatch stop the script, while the printed values and metadata show the usable result.

Steps to create a NumPy array:

  1. Create array-create.py with the NumPy import and nested temperature rows.
    array-create.py
    import numpy as np
     
    readings = [
        [18.5, 19.2, 17.8],
        [20.1, 18.9, 19.6],
    ]
  2. Append the explicit np.float64 conversion to array-create.py.
    temperatures = np.array(readings, dtype=np.float64)
  3. Append the expected two-row, three-column shape assertion to array-create.py.
    assert temperatures.shape == (2, 3)
  4. Append the float64 dtype assertion to array-create.py.
    assert temperatures.dtype == np.float64
  5. Append readable array values and metadata to array-create.py.
    print("temperatures:")
    print(temperatures)
    print("shape:", temperatures.shape)
    print("dtype:", temperatures.dtype)
  6. Run array-create.py with Python 3 to confirm the created NumPy array.
    $ python3 array-create.py
    temperatures:
    [[18.5 19.2 17.8]
     [20.1 18.9 19.6]]
    shape: (2, 3)
    dtype: float64