ソースコード
#coding:utf8
#入力関数
import os
import math
os.system("clear")
print("\n\n------------商品購入-----------")
flag = True
# 買い物の消費税の種類をえらんでもらう。
choice = input("1:食料品 2:それ以外")
# if choice == '1':
# tax_rate = 0.08
# elif choice == '2'
# tax_rate = 0.10
if choice in ['1','1']:
tax_rate = 0.08
elif choice in ['2','2']:
tax_rate = 0.1
else:
print("入力ミス。")
flag =False
#買い物の値段計算
if flag ==True:
product_name = input("品名: ")
price=float(input('単価: '))
qty=float(input('数量: '))
total_price=(1+tax_rate)*price*qty
print(f'{product_name} 合計 {total_price:.0f}円 \n 単価 {price}円 税商品{tax_rate} 数量 {qty} ')