Instead of using len
, i am using enumerate
function. In it, how can i get total number of items?
Sample code:-
data = ['bat','cat','eat','fat','தொப்பி','எலி'] for itemNum, item in enumerate(data): print(itemNum+1, end='')
result: 123456
expected result: 6
https://stackoverflow.com/questions/67345588/python3-how-to-use-enumerate-to-print-total-items-in-a-list May 01, 2021 at 07:10PM
没有评论:
发表评论