human
Program to print modified Binary triangle pattern | Function to print the modified binary pattern.
Loop to traverse the rows.
Loop to traverse the numbers in each row.
Check if j is 1 or i In either case print 1.
Else print 0.
Change the cursor to next line after each row.
Driver Code.
Function Call"
How can the above be solved in Python?
assistant
#Here is code to program to print modified Binary triangle pattern and the other steps required.
 def modifiedBinaryPattern ( n ) :
	for i in range ( 1 , n + 1 , 1 ) :
		for j in range ( 1 , i + 1 , 1 ) :
			if ( j == 1 or j == i ) :
				print ( 1 , end = " " )
			else :
				print ( 0 , end = " " )
		print ( ' ' , end = " " )
if __name__ == ' _ _ main _ _ ' :
	n = 7
	modifiedBinaryPattern ( n )