##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 09\09.17 - Creating a price table in JSON format.py
# Description: Creating a price table in JSON format
##############################################################################
import json
from pathlib import Path
price_table = {}
print("Price list creator")
print("Enter a blank product name to finish")
while product := input("Product name:"):
price = input("Price:")
price_table[product] = price
with Path("prices.json").open("w", encoding="utf-8") as file:
json.dump(price_table, file)