def main() -> None:
    products = {
    "coke":40,
    "layschips":20,
    "waterbottle":10,
    "marsbar":80,
    "boomeranggum":5,
    "maxproteinshake":120   
    }

    print("Available Products: ")
    for item in products:
        print(item," - ",products[item])

    while True:

        try:
            money = int(input("Enter the amount: "))
    
            if money<0:
                raise ValueError
            break
        except ValueError:
            print("Please enter a valid number")

    print("Affordable Products: ")
    for item,value in products.items():
        if value<=money:
            print(item," - ",value)

    print()
    print("Unaffordable Products: ")
    for item,value in products.items():
        if value>money:
            print(item," - ",value)

    purchase = input("Enter the name of the product you would like to buy:").lower().replace(" ","")
    if not purchase:
        print("no product selected")
        return
    if purchase not in products:
        print("Not available")
        return
    price = products[purchase]
    if price>money:
        print("insufficient money")
        return
    else:
        print(f"You have purchased '{purchase}' ")
    money -= price

    print()
    print("Money left: ",money)
    print("Thank you for shopping with us")

if __name__ == "__main__":
    main()
