human
Given 1 ' s , ▁ 2' s , 3 ' s ▁ . . . . . . k ' s print them in zig zag way . | function that prints given number of 1 ' s , ▁ 2' s , 3 ' s ▁ . . . . k ' s in zig - zag way ..
two - dimensional array to store numbers ..
for even row ..
for each column ..
storing element ..
decrement element at kth index ..
if array contains zero then increment index to make this next index.
for odd row ..
for each column ..
storing element ..
decrement element at kth index ..
if array contains zero then increment index to make this next index ..
printing the stored elements ..
Driver code"
How can the above be solved in Python?

Write me a code to given 1 ' s , ▁ 2' s , 3 ' s ▁?
assistant
#Here is code to given 1 ' s , ▁ 2' s , 3 ' s ▁ .
 def ZigZag ( rows , columns , numbers ) :
	k = 0
	arr = [ [ 0 for i in range ( columns ) ] for j in range ( rows ) ]
	for i in range ( rows ) :
		if ( i % 2 == 0 ) :
			j = 0
			while j < columns and numbers [ k ] > 0 :
				arr [ i ] [ j ] = k + 1
				numbers [ k ] -= 1
				if numbers [ k ] == 0 :
					k += 1
				j += 1
		else :
			j = columns - 1
			while j >= 0 and numbers [ k ] > 0 :
				arr [ i ] [ j ] = k + 1
				numbers [ k ] -= 1
				if numbers [ k ] == 0 :
					k += 1
				j -= 1
	for i in arr :
		for j in i :
			print ( j , end = " ▁ " )
		print ( )
rows = 4 ;
columns = 5 ;
Numbers = [ 3 , 4 , 2 , 2 , 3 , 1 , 5 ]
ZigZag ( rows , columns , Numbers )