I'd probably start by making a function which takes an integer argument and returns 1,3,5,7,9,7,5,3,1. Then maybe another function to build line number n (returning a string), and have the main program containing a simple loop which calls it.
Splitting up a program in to functions might even get you extra marks (assuming that's been discussed in you class).
|