如果输入为 3,我如何实现以下模式?
AA
BBAA
AABBAA
我能得到的最远的是:
AA
BBBB
AAAAAA
我尝试了以下方法:
#mod operator used to alternate patterns
pattern_size = int (input ("Input height : "))
for level in range (1, pattern_size +1):
for x in range (level):
# print AA if remainder != 0
if level % 2 != 0:
print ("AA", end = '')
# print BB if remainder = 0
if level % 2 == 0:
print ("BB", end = '')