Author Topic: Python - Simple Program to Display an Array of Integers  (Read 683 times)

kathir

  • Administrator
  • Sr. Member
  • *****
  • Posts: 283
Python - Simple Program to Display an Array of Integers
« on: January 04, 2012, 04:15:29 pm »
Here is the simple python program to display an Array of Integers

Code: (Python)
#Python Source File

array_numbers = [ 10, 20, 30, 40, 50, 60 ]
print "The length of the array is: %i" %len(array_numbers)

for i in range(0, len(array_numbers) ):
     print "Position %i Value %d" %(i + 1, array_numbers[i])

Output:

The length of the array is: 6
position 1 value 10
position 2 value 20
position 3 value 30
position 4 value 40
position 5 value 50
position 6 value 60

 


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1