xxxxxxxxxx
numbers = 10
for rowIndex in range(numbers):
rowString = ''
for columnIndex in range(numbers): #Same number of points
#each row is equivalent to the previous row + 1 - use existing iterator
rowString += str(columnIndex + rowIndex) + '\t'
print(rowString)
xxxxxxxxxx
rows = 6 #Pattern(1,121,12321,1234321,123454321)
for i in range(1, rows + 1):
for j in range(1, i - 1):
print(j, end=" ")
for j in range(i - 1, 0, -1):
print(j, end=" ")
print()
xxxxxxxxxx
k=int(input('value of a: '))
for a in range(1,k):
for b in range(1,k):
if a==b:
print('A',end=" ")
else:
print('B',end=" ")
print()
________________________________________________________________________________
xxxxxxxxxx
def pattern(n):
for i in range(0,n):
for j in range(0, i+1):
print("* " , end="")
print("\r") pattern(5
xxxxxxxxxx
v = 1
lines = 4
for i in range(lines):
for j in range(i):
print(v, end=' ')
v += 1
print( )
xxxxxxxxxx
def pattern(n): for i in range(0,n): for j in range(0, i+1): print("* " , end="") print("\r") pattern(5)