0
点赞
收藏
分享

微信扫一扫

python 如何获取列表长度

灯火南山 2022-02-05 阅读 82
Get list length in Python 3Examples
len() functionlist = [10, 20, 30]
n = len(list)
print(“The length of list is: “, n)
for looplist = [‘Python’,’Java’,’Kotlin’,’Machine Learning’,’Keras’]
size = 0
print(“Length of the input string:”)
for x in list:
size+=1
print(size)
len() function for nested listnestedList = [‘Krishna’, 20,’John’, [20, 40, 50, 65, 22], ‘Yung’, 11.98]
print(“Original List = “, nestedList)
print(“Length of a Nested List = “, len(nestedList[3]))

how to get list length in python

举报

相关推荐

0 条评论