human
Find unit digit of x raised to power y | Returns unit digit of x raised to power y.
Initialize result as 1 to handle case when y is 0..
One by one multiply with x mod 10 to avoid overflow ..
Driver program"
How can the above be solved in Python?
assistant
#Here is code to find unit digit of x raised to power y and the other steps required.
 def unitDigitXRaisedY ( x , y ) :
	res = 1
	for i in range ( y ) :
		res = ( res * x ) % 10
	return res
print ( unitDigitXRaisedY ( 4 , 2 ) )