Python basic

Course Name: Python for Trading: Basic, Section No: 2, Unit No: 16, Unit type: Quiz
Suppose the following versions of the ‘XYZ’ package are available in PyPi

[0.4.0, 0.3.5, 0.3.4, 0.3.3, 0.3.2, 0.3.1, 0.3.0, 0.2]

If you run the following command in IPython, which version of the package is installed?

   !pip install XYZ

can anyone explain the answer

Thank you for your question.

The correct answer is c) 0.4.0.

When you run:

!pip install XYZ

without specifying a version number, pip installs the latest available version of the package from PyPI by default. In the list provided:

[0.4.0, 0.3.5, 0.3.4, 0.3.3, 0.3.2, 0.3.1, 0.3.0, 0.2]

the latest version is 0.4.0, so that is the version that will be installed.

You may notice that the options shown in the course differ from some older discussions or screenshots. The question was updated to use package versions that are easier to compare and understand, but the underlying concept remains the same: if no version is specified, pip installs the latest available version of the package.

1 Like

Thanks you for your help. I understand if we specify version it will installed that perticular version but if dont then it will install latest one.