### Thread: python enumerate

1. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Oct 2017
Posts
20
Rep Power
0

#### python enumerate

Code:
```import itertools

class SoccerTeams:

Groups1 = "Beitar Jerusalem", "VS", "Maccabi Haifa"
Groups2 = "Hapoel Tel Aviv", "VS", "Hapoel Beer Sheva"
GameNumber = "Game-Number", "250", "260"

x = SoccerTeams()
print(x.Groups1, x.GameNumber[0], x.GameNumber[1])
print(x.Groups2, x.GameNumber[0], x.GameNumber[2])
print('\n')

for pair in enumerate(itertools.product('1x2', '1x2')):
print(pair)```

print output:

('Beitar Jerusalem', 'VS', 'Maccabi Haifa') Game-Number 250
('Hapoel Tel Aviv', 'VS', 'Hapoel Beer Sheva') Game-Number 260

(0, ('1', '1'))
(1, ('1', 'x'))
(2, ('1', '2'))
(3, ('x', '1'))
(4, ('x', 'x'))
(5, ('x', '2'))
(6, ('2', '1'))
(7, ('2', 'x'))
(8, ('2', '2'))

I try to print an example:
This problem is number 0
(1, ('1', '1'))
(2, ('1', 'x'))
(3, ('1', '2'))
(4, ('x', '1'))
(5, ('x', 'x'))
(6, ('x', '2'))
(7, ('2', '1'))
(8, ('2', 'x'))
(9, ('2', '2'))

enumerate
I could not put number 1 in any option by the example here

for count, item in enumerate(grocery, 1):
print(count, item)
2. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Oct 2017
Posts
20
Rep Power
0

#### I found the answer

I found the answer

Code:
```aa_a = itertools.product('1x2', '1x2')

for pair, val in enumerate(aa_a, 1):
print(pair, val)
```
3. Yes many of these python function methods and functions have optional arguments that can be useful. I often use sort(key=function)
4. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Oct 2017
Posts
20
Rep Power
0
I went back to the language I love very much in Python
And this time I'm going in very deep I want to understand it to the end
I'm still a novice
The forum here is very excellent. I like to thank everyone. Thank you very much
��