(Nov-17-2018, 11:19 PM)ichabod801 Wrote: You don't really need print_segment. You don't want to loop there, you just want the print statement. So get rid of print_segment and just replace it with the print statement. Then your loop in print_spruce should start with 1. Then you are just missing one bit you should be able to figure out yourself.
I did this...
print("Write the size of the spruce:") n = int(input()) print_spruce(n) def print_spruce(size): for i in range(1, size+1, 2): print(i, size)And then got this...
Write the size of the spruce: 4 Traceback (most recent call last): File "assign.py", line 3, in <module> print_spruce(n) NameError: name 'print_spruce' is not definedWhat am I doing wrong?
rint("Write the size of the spruce:") n = int(input()) print_spruce(n) def print_spruce(n): for size in range(1, n+1, 2): print((size * "X").center(n)) print_spruce(n)terminal:
Write the size of the spruce: 9 Traceback (most recent call last): File "assign.py", line 3, in <module> print_spruce(n) NameError: name 'print_spruce' is not defined