PrintArray Function
From CompSciWiki
Back to the Program-A-Day homepage
ProblemWrite a function that takes an array as its parameter and then print the elements in the array |
Arrays and Functions | |
---|---|---|
SolutionWrite the main function def main(): #class list for comp 1010 String [] comp1010 = { "Adam", "Bob", "Carl", "David", "Edward"}; #class list for comp 1020 String [] comp1020 = { "Amy", "Beth", "Cindy", "Dawn", "Ellen"}; #class list for comp 1260 String [] comp1260 = { "Mike", "Mary", "Matthew", "Megan", "Moe"}; print 'comp1010:\n' printArray(comp1010) print 'comp1020:\n' printArray(comp1020) print 'comp1260:\n' printArray(comp1260) main() Now your task is to compelete the printArray function. | ||
Code |