Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Semrush - keyword research tool

Create your online store today with Shopify

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Disclosure: My content contains affiliate links.

43,700 questions

57,013 answers

573 users

How to enumerate initialized array with a range of int numbers in Python

1 Answer

0 votes
import array 
 
a = array.array('i', range(5, 9)) # i = int
print(a)   

lst = list(enumerate(a))
print(lst)

print(lst[0])

for en, val in lst:
    print(en, val)
 
 
'''
run:
  
array('i', [5, 6, 7, 8])
[(0, 5), (1, 6), (2, 7), (3, 8)]
(0, 5)
0 5
1 6
2 7
3 8
 
'''

 



answered May 11, 2019 by avibootz

Related questions

2 answers 364 views
1 answer 287 views
3 answers 400 views
1 answer 249 views
1 answer 276 views
3 answers 336 views
...