"""
Program Name: Perform common functions on menu
Description: append, insert, index, count, sort, min, max, pop, remove
"""
perform_on = input("Enter numbers giving space : ")
perform_on = perform_on.split()
x = []
i = 0
while i < len(perform_on) :
x.append(int(perform_on[i]))
i +=1
option = input("Option : \n1. append \n2. insert \n3. index \n4. count \n5. sort \n6. min \n7. max \n8. pop \n9. remove \nEnter your choice : ")
if option == "1" :
n = input("Enter number to append : ")
x.append(int(n))
print(f"Updated list : {x}")
elif option == "2" :
index = int(input("Enter index to insert :"))
n = int(input("Enter number to insert : "))
x.insert(index, n)
print(f"Updated list : {x}")
elif option == "3" :
n = int(input("Enter number to find index : "))
if n in x :
print(f"Index : {x.index(n)}")
else :
print("Index number not found.")
elif option == "4" :
n = int(input("Enter the number to count in list : "))
print(f"Count : {x.count(n)}")
elif option == "5" :
x.sort()
print(f"Sorted list : {x}")
elif option == "6" :
print(f"Minimum number : {min(x)}")
elif option == "7" :
print(f"Maximum number : {max(x)}")
elif option == "8" :
if len(x) > 0 :
index = int(input("Enter index to pop : "))
if index < len(x) :
x.pop(index)
print(f"Updated list : {x}")
else :
print("Invalid Index")
else :
print("List is empty")
elif option == "9" :
n = int(input("Enter number to remove :"))
if n in x :
x.remove(n)
print(f"Updated list : {x}")
else :
print(f"{n} is already not present in the list.")
else :
print("Invalid option")