Bacancy Technology
Bacancy Technology represents the connected world, offering innovative and customer-centric information technology experiences, enabling Enterprises, Associates and the Society to Rise™.
12+
Countries where we have happy customers
1050+
Agile enabled employees
06
World wide offices
12+
Years of Experience
05
Agile Coaches
14
Certified Scrum Masters
1000+
Clients projects
1458
Happy customers
Artificial Intelligence
Machine Learning
Salesforce
Microsoft
SAP
January 10, 2024
You can use the enumerate function in Python to iterate over a sequence and simultaneously get the index and the value. Here’s how you can modify your code to achieve the desired output:
xs = [8, 23, 45] for index, x in enumerate(xs, start=1): print("item #{} = {}".format(index, x))