logo CodeStepByStep logo

spaced_numbers2

Language/Type: Python basics for loops

Modify your code from the previous exercise so that it could easily be modified to display a different range of numbers (instead of 1234567890) and a different number of repetitions of those numbers (instead of 60 total characters), with the vertical bars still matching up correctly. Use two constants named MAX and TIMES instead of "magic numbers." Here are some example outputs that could be generated by changing your constants:

MAX = 5
TIMES = 10

|    |    |    |    |    |    |    |    |    |
12340123401234012340123401234012340123401234012340
MAX = 8
TIMES = 7

|       |       |       |       |       |       |
12345670123456701234567012345670123456701234567012345670

(Do not define the constants in your own code; we will define them in our testing code, and you should use them in your function.)

Function: Write a Python function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.