human
Queries to update array by adding or multiplying array elements and print the element present at specified index | Function to modify the array by performing given queries.
Stores the multiplication of all integers of type 1.
Stores the value obtained after performing queries of type 1 & 2.
Iterate over the queries.
Query of type 0.
Update the value of add.
Query of type 1.
Update the value of mul.
Update the value of add.
Otherwise.
Store the element at index Q [ i ] [ 1 ].
Prthe result for the current query.
Driver Code"
How can the above be solved in Python?

Give me a code to queries to update array by adding or multiplying array elements and print the element present at specified index and the other steps required?
assistant
#Here is code to queries to update array by adding or multiplying array elements and print the element present at specified index and the other steps required.
 def Query ( arr , N , Q ) :
	mul = 1
	add = 0
	for i in range ( len ( Q ) ) :
		if ( Q [ i ] [ 0 ] == 0 ) :
			add = add + Q [ i ] [ 1 ]
		elif ( Q [ i ] [ 0 ] == 1 ) :
			mul = mul * Q [ i ] [ 1 ]
			add = add * Q [ i ] [ 1 ]
		else :
			ans = arr [ Q [ i ] [ 1 ] ] * mul + add
			print ( ans , end = " ▁ " )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 3 , 1 , 23 , 45 , 100 ]
	N = len ( arr )
	Q = [ [ 1 , 2 ] , [ 0 , 10 ] , [ 2 , 3 ] , [ 1 , 5 ] , [ 2 , 4 ] ]
	Query ( arr , N , Q )