So I'm pretty upset I can't figure something this seemingly trivial out as I'm fairly well versed in Java, but anyways my professor for introduction to Python assigned us a lab where we have to create a pattern with letters based on row and column position. No loops or iterations, just conditional statements.
For instance, this function:
def letter(row, col):
if row>col:
return 'T'
else:
return 'W'
would yield:
WWWWWWWWWWWWWWWWWWWW
TWWWWWWWWWWWWWWWWWWW
TTWWWWWWWWWWWWWWWWWW
TTTWWWWWWWWWWWWWWWWW
TTTTWWWWWWWWWWWWWWWW
TTTTTWWWWWWWWWWWWWWW
TTTTTTWWWWWWWWWWWWWW
TTTTTTTWWWWWWWWWWWWW
TTTTTTTTWWWWWWWWWWWW
TTTTTTTTTWWWWWWWWWWW
TTTTTTTTTTWWWWWWWWWW
TTTTTTTTTTTWWWWWWWWW
TTTTTTTTTTTTWWWWWWWW
TTTTTTTTTTTTTWWWWWWW
TTTTTTTTTTTTTTWWWWWW
TTTTTTTTTTTTTTTWWWWW
TTTTTTTTTTTTTTTTWWWW
TTTTTTTTTTTTTTTTTWWW
TTTTTTTTTTTTTTTTTTWW
TTTTTTTTTTTTTTTTTTTW
if run through his driver file with row and col both equaling 20.
The one I'm stuck with is creating a function for the pattern:
XOOOOOX
OXOOOXO
OOXOXOO
OOOXOOO
OOXOXOO
OXOOOXO
XOOOOOX
Please do NOT spoonfeed me the answer, rather point me in the right direction.
So far I know that the X's for the left->right diagonal can be identified when row==col. It's the right->left diagonal I'm having issues with.
Thanks a lot.