Answer:
Following are the program in the Python Programming Language.
#define function
def isPalindrome(test):
#set the if condition to check tuple is empty
if(len(test)==0):
return True
#Check the tuple contain 1 element
elif(len(test)==1):
return True
#check the element of tuple is palindrome or not
else:
lenth=len(test)
#check first last element is equal or not
if(test[0]==test[lenth-1] and isPalindrome(test[1:lenth-1] ) ):
#then, return true
return True
#otherwise
else:
#Return False,
return False
#define tuple type variable and initialize
test=(1,2,3,4,3,2,1)
#print and call the function
print(isPalindrome(test))
Output:
True
Explanation:
Here, we define a function "palindrome()" and pass an argument in its parameter, inside the function.