w3resource

NumPy: Print the NumPy version in your system

NumPy: Array Object Exercise-1 with Solution

Print NumPy Version

Write a NumPy program to print the NumPy version on your system.

Sample Solution:-

Python Code:

# Importing the NumPy library with an alias 'np'
import numpy as np

# Printing the version of NumPy installed
print(np.__version__)

Sample Output:

1.12.0

Explanation:

In the above code -

print(np.__version__): Accesses the __version__ attribute of the NumPy library, which holds a string representing the version number of the currently installed NumPy package. This line prints the version number.

NumPy version:

class numpy.lib.NumpyVersion(vstring): Parse and compare numpy version strings.

New in version 1.9.0.
Parameters vstring : str
NumPy version string (np.__version__).

Python-Numpy Code Editor:

Previous: NumPy Array Object Exercises Home.
Next: Write a NumPy program to convert a list of numeric value into a one-dimensional NumPy array.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/python-exercises/numpy/python-numpy-exercise-1.php