Print an Array

From CompSciWiki
Revision as of 23:18, 3 April 2012 by YulinT (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Back to the Program-A-Day homepage

Problem

Print an array using a for loop

 

Introducing Array

Solution

Create an array that has 10 elements

 array = [0,1,2,3,4,5,6,7,8,9,10] 

Use for loop to print these elements

 for element in array:
  print element 

Code

Solution Code

Back to the Program-A-Day homepage