Python CODE help

Issue with this code ?
Only Python TAs should take it up

# Problem ID 331 even after odd in a LL
class Node:
    def __init__(self, data):
        self.data = data
        self.next = None

    
def ll(arr):
    if len(arr)==0:
        return None
    head = Node(arr[0])
    last = head
    for data in arr[1:]:
        last.next = Node(data)
        last = last.next
    return head


def printll(head):
    while head:
        print(head.data, end=' ')
        head = head.next

def odd_even(head):
	if head is None or head.next is None:
		return head
	oh=head
	eh=head.next
	temp=head.next.next
	ot=oh
	et=eh
	ot.next=None
	et.next=None
	
	while temp:
		ot.next=temp
		temp=temp.next
		ot=ot.next
		ot.next=None
		if temp is None:
			break
		et.next=temp
		et=et.next
		temp=temp.next
		et.next=None

	ot.next=eh
	return oh




n=int(input())
arr=[int(i) for i in input().strip().split(' ')]

head=ll(arr)
printll(odd_even(head))

@KartikKhariwal Please look this too

No one took it yet ?

@ritvikagrawal1
Your algorithm is correct. What’s wrong is your output format. Look at the sample output and you’ll notice that you are required to print “Original List” and “Modified List” as well.

Change the last part of your code to this and it will succeed.

head=ll(arr)
print("Original List:",*arr)
print("Modified List:",end=' ')
printll(odd_even(head))

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Resolved. Thank you!