Program to find greater value between a ^ n and b ^ n | Python3 code for finding greater between the a ^ n and b ^ n ; Function to find the greater value ; If n is even ; Driver code
import math NEW_LINE def findGreater ( a , b , n ) : NEW_LINE INDENT if ( ( n & 1 ) > 0 ) : NEW_LINE INDENT a = abs ( a ) ; NEW_LINE b = abs ( b ) ; NEW_LINE DEDENT if ( a == b ) : NEW_LINE INDENT print ( " a ^ n ▁ is ▁ equal ▁ to ▁ b ^ n " ) ; NEW_LINE DEDENT elif ( a > b ) : NEW_LINE INDENT print ( " a ^ n ▁ is ▁ greater ▁ than ▁ b ^ n " ) ; NEW_LINE DEDENT else : NEW_LINE INDENT print ( " b ^ n ▁ is ▁ greater ▁ than ▁ a ^ n " ) ; NEW_LINE DEDENT DEDENT a = 12 ; NEW_LINE b = 24 ; NEW_LINE n = 5 ; NEW_LINE findGreater ( a , b , n ) ; NEW_LINE