4/13/23, 4:52 AM Copy of Linked Lists.
ipynb - Colaboratory
l1 = []
[Link]("India")
[Link]("Japan")
[Link]("America")
print("The existing list = ",l1)
choice = 0
while choice <5:
print('Linked list operation')
print('1. Add element')
print('2. Remove element')
print('3. Replce element')
print('4. search element')
print('5. Exit')
choice = int(input('your choice'))
if choice==1:
element=input('Enter element: ')
pos=int(input('At what position'))
[Link](pos,element)
elif choice==2:
try:
element=input('Enter element: ')
[Link](element)
except ValueError:
print('Element not found')
elif choice==3:
element=input('Enter element: ')
pos=int(input('At what position'))
[Link](pos)
[Link](pos,element)
elif choice==4:
element=input('Enter element:')
try:
pos=[Link](element)
print('element found at position:',pos)
except ValueError:
print("element not found")
else:
break
print('List= ',l1)
[Link] 1/3
4/13/23, 4:52 AM Copy of Linked [Link] - Colaboratory
The existing list = ['India', 'Japan', 'America']
Linked list operation
1. Add element
2. Remove element
3. Replce element
4. search element
5. Exit
your choice1
Enter element: Russia
At what position0
List= ['Russia', 'India', 'Japan', 'America']
Linked list operation
1. Add element
2. Remove element
3. Replce element
4. search element
5. Exit
your choice2
Enter element: Russia
List= ['India', 'Japan', 'America']
Linked list operation
1. Add element
2. Remove element
3. Replce element
4. search element
5. Exit
your choice3
Enter element: Indonesia
At what position1
List= ['India', 'Indonesia', 'America']
Linked list operation
1. Add element
2. Remove element
3. Replce element
4. search element
5. Exit
your choice4
Enter element:India
element found at position: 0
List= ['India', 'Indonesia', 'America']
Linked list operation
1. Add element
2. Remove element
3. Replce element
4. search element
5. Exit
your choice5
[Link] 2/3
4/13/23, 4:52 AM Copy of Linked [Link] - Colaboratory
Colab paid products - Cancel contracts here
[Link] 3/3