import sys


shopping_list = ["bread", "cheese", "milk", "chocolate"]
prices = [4.99, 6.77, 2.99, 7.49]
shopping_list.append("cucumber")
prices.append(1.99)

shopping_list.append("tomato")
prices.append(4.99)

print(shopping_list)
lenght_of_shopping_list = len(shopping_list) - 1
try:
    choice = int(input(f"Select one element in the list above by writing it index (0 - {lenght_of_shopping_list}): "))
except: 
    print("it must be a number")
    sys.exit()

try:
    print(f"you choose:{shopping_list[choice]} with price: ${prices[choice]}")
except:
    print(f"The index you choose is out of the list")

# shopping_list[choice]

# try:
#     shopping_list.remove("tomato")
# except:
#     print("Tomato is not in the list")

