+ 10

If we have a string and numeric value too in an array then , if we print that array then output array will be string or of mixed

Related to python

6th Apr 2019, 2:40 AM
Yash Srivastava
Yash Srivastava - avatar
5 odpowiedzi
+ 10
The numpy array will not be of number or mixed type it will be of string type A=np.array(["yash","harsh",1]) print(A) So output will be ["yash","harsh","1"] string type
6th Apr 2019, 1:50 PM
Yash Srivastava
Yash Srivastava - avatar
+ 7
The type (str, int, etc.) of an element in a list won't change if we print the list. lst = ["hello", "world", 42] print(lst) print(type(lst)) print([type(i) for i in lst]) Output: ['hello', 'world', 42] <class 'list'> [<class 'str'>, <class 'str'>, <class 'int'>]
6th Apr 2019, 4:26 AM
Diego
Diego - avatar
+ 3
An Array can store elements of one type only!!
11th Apr 2019, 12:56 PM
Saurabh Gupta
Saurabh Gupta - avatar
+ 2
omg
14th Apr 2019, 2:06 AM
Jay
Jay - avatar
+ 2
Nice question
14th Apr 2019, 10:48 AM
Harsh Srivasvatava