python 如何获取列表长度

python 如何获取列表长度,第1张

python 如何获取列表长度 Get list length in Python 3Exampleslen() 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

create a list in python

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5720750.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-18

发表评论

登录后才能评论

评论列表(0条)

保存