Get the App
SLTechnology News&Howtos  ›  Development  › 

How python uses the enumerate () function

Shulou Source: shulou.com Published: 2022-06-01 02:37:57 09月21日 Update

Editor to share with you how python uses the enumerate () function, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Enumerate ()

Enumerate (): this function takes a collection (for example, tuples) and returns it as an enumeration object.

X = ["Zhang San", "Li Si", "Wang Wu"] for index, value in enumerate (x): print (f "my name is {value}, my index in the list is {index}")

The results are as follows:

These are all the contents of the article "how python uses the enumerate () function". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Functions articles content not much most objects more knowledge index results industry information information channels channels Zhang San Li Si Wang Wu and will reference learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS NVidia vpn Linux