[Python] Can 'array' be a variable name?

Discussão em 'Python' iniciado por Stack, Outubro 4, 2024.

  1. Stack

    Stack Membro Participativo

    In the following example 1:

    <example 1>

    import numpy as np

    np.array([0,1,2,3,4])


    Is array after np. a method function? If so, can array be used as a variable name? Please check the the following example 2?

    <example 2>

    import numpy as np

    array = np.arange(5)

    print(array)


    Are 'array' in example 1 and example 2 different or same?

    Continue reading...

Compartilhe esta Página