To determine the length of an array

Asked 2 years ago, Updated 2 years ago, 114 views

Is arr._len_() the only function that returns the array length?

As far as I know, I've learned that it's not good to write functions or variables that start with an underline (_), but I can't find any other way

python list array size

2022-09-21 18:48

1 Answers

len(s) functions.

I think you mentioned list when it comes to arrangement In addition to list, len(s) takes sequence such as tuple and dict and collection type factors to return the length of the object.

mylist = [1,2,3,4,5]
len(mylist)

mytuple = (1,2,3,4,5)
len(mytuple)

mydict = {1:2, 2:3}
len(mydict)


2022-09-21 18:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.