doubt in shape function
Title
Question
--------------------------------------------------------
In [68]: print(ar)
[1 2 3 4 5 6 7 8]
In [69]: ar.shape()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-69-895c9f3eff17> in <module>
----> 1 ar.shape()
TypeError: 'tuple' object is not callable
Python-3.4.3 Getting-started-with-arrays 05-06 min 0-10 sec
Answers:
Your variable ar is a list and not an array. shape function is callable with array only.
Also you have typed the wrong syntax.
Type ar= array([1,2,3,4,5,6,7,8]) and then type ar.shape. you will get the shape of the array.
Login to add comment