enumerate python
for index,subj in enumerate(subjects):
print(index,subj) ## enumerate will fetch the index
0 Statistics
1 Artificial intelligence
2 Biology
3 Commerce
4 Science
5 Maths
enumerate python
for index,subj in enumerate(subjects):
print(index,subj) ## enumerate will fetch the index
0 Statistics
1 Artificial intelligence
2 Biology
3 Commerce
4 Science
5 Maths
for loop with enumerate python
presidents = ["Washington", "Adams", "Jefferson"]
for num, name in enumerate(presidents, start=0):
print("President {}: {}".format(num, name))
enumerate in Python
>>> def my_enumerate(sequence, start=0):
... n = start
... for elem in sequence:
... yield n, elem
... n += 1
...
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us