ソースコード
#coding:utf-8
#入力関数inputの利用と型変換(キャスティング)
import os
import math
os.system("clear")
#文字列入力
a=input("あなたのお名前は何ですか?")
print(f'名前は{a}ですね。')
b=input("あなたは何才ですか?")
print(f'{b}才ですね。')
print(type(a),type(b))
#数値入力するとき型変換を行う
x=int(input("一つの整数をいれて:"))
print(type(x),x)
y=float(input("一つの実数をいれて:"))
print(type(y),y)
z=x+y
print(type(z),z)
#計算
r=float(input("半径はいくらですか: "))
area=math.pi*math.pow(r,2)
print(f'半径={r} 面積={area:.2f}')
lenth=2*math.pi*r
print(f'半径={r} 周長={lenth:.2f}')
#買い物の値段計算
print("\n\n----------食料品の購入---------")
product_name=input("品名: ")
app_price=int(input("単価: "))
tax_rate=0.08
qty=float(input("数量: "))
total_price=(1+tax_rate)*app_price*qty
print(f'{product_name} 合計 {total_price:.0f}円 \n 単価 {app_price}円 消費税 {tax_rate} 購入個数 {qty}')
print("\n\n----------日常用品の購入---------")
product_name=input("品名: ")
app_price=int(input("単価: "))
tax_rate=0.10
qty=float(input("数量: "))
total_price=(1+tax_rate)*app_price*qty
print(f'{product_name} 合計 {total_price:.0f}円 \n 単価 {app_price}円 消費税 {tax_rate} 購入個数 {qty}')