I'm having trouble on printing alternate pattern, the output is suppose to look like this:
input height: 7
22
1122
221122
11221122
2211221122
112211221122
22112211221122
But instead it came out like this:
input height: 7
22
1111
222222
11111111
2222222222
111111111111
22222222222222
Code:
height = int (input ("input height: "))
for level in range (1, height+1):
num = level
for x in range (num):
if( level%2==0): #Even row starts with "11" first
print ("11",end = "")
else:
print ("22",end = "")
print()
By using looping, while, for loop, no list. How can I do this?
2*level - level? isn't that= level?