# Move vowels node at the beginning of linked list in python

Python program for Move vowels node at the beginning of linked list. Here problem description and other solutions.

``````#  Python 3 program for
#  Shift the vowels node at beginning of linked list

def __init__(self, data) :
self.data = data
self.next = None

class SingleLL :
def __init__(self) :
self.tail = None

else :
#  Append the node at last position
self.tail.next = node

self.tail = node

def display(self) :
return

while (temp != None) :
print("", temp.data ,end = " →")
#  Visit to next node
temp = temp.next

print(" NULL")

#  Determine that given value is an vowel or not
def isVowels(self, value) :
if (value == 'a'
or value == 'e'
or value == 'i'
or value == 'o'
or value == 'u'
or value == 'A'
or value == 'E'
or value == 'I'
or value == 'O'
or value == 'U') :
return True

return False

#  Move the vowels value at beginning position
def shiftVowels(self) :
return

#  Define some auxiliary variable
back = None
#  And shift vowels at front of linked list
while (node != None) :
if (self.isVowels(node.data) == True and back != None) :
#  Enter here when
#  Node is contain vowel and
#  its previous (any) node is not form of vowel
if (node == self.tail) :
#  When is last node
#  Set new last node
self.tail = back

#  Connect previous node to next node
back.next = node.next
#  Connect vowel node to first node
#  Get back node
node = back
else :
back = node

#  Visit to next node
node = node.next

def main() :
sll = SingleLL()
print(" Before move vowels")
#  E → D → U → C → A → T → I → O → N → NULL
sll.display()
sll.shiftVowels()
print(" After move vowels")
#  O → I → A → U → E → D → C → T → N → NULL
sll.display()

if __name__ == "__main__": main()``````

Output

`````` Before move vowels
E → D → U → C → A → T → I → O → N → NULL
After move vowels
O → I → A → U → E → D → C → T → N → NULL``````

## Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.