Program Console Vignaankosh.com
Execution Panel
Console is empty.
Check whether tuple is palindrome is an interactive PYTHON dry run visualizer from the Tuples programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.
This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.
# Check if tuple reads same forward and backward
tuple1 = (4, 8, 12, 8, 4)
tuple2 = (4, 8, 12, 16, 20)
tuple3 = ('r', 'a', 'c', 'e', 'c', 'a', 'r')
def is_palindrome(t):
return t == t[::-1]
print(f"{tuple1} is palindrome: {is_palindrome(tuple1)}")
print(f"{tuple2} is palindrome: {is_palindrome(tuple2)}")
print(f"{tuple3} is palindrome: {is_palindrome(tuple3)}")
# Two-pointer method
def is_palindrome_two_pointer(t):
left, right = 0, len(t) - 1
while left < right:
if t[left] != t[right]:
return False
left += 1
right -= 1
return True
print(f"\nTwo-pointer: {tuple1} → {is_palindrome_two_pointer(tuple1)}")