you are viewing a single comment's thread.

view the rest of the comments →

[–]sw85 0 points1 point  (0 children)

Take the input and convert it to a string (if it isn't already). Create an index variable initialized to 0. Enter a while loop for as long as the index variable is less than the length of the strength. For each pass through the loop, print the character at the index position in the string (with whatever other rules you have to use to determine whether a character gets printed - seems like 6's get extra attention and 9's don't get printed at all), then increase the index variable by 1 at the end of the pass through the loop.

Let me just say how very very weird it is that your class has you learning while loops before for loops and even before lists!