ソースコード
#coding:utf8
#入力関数
import os
import math
os.system("clear")
#文字列入力する時は是非型変換を行う。(キャスティング)
a=input(f'名前はなんですか。')
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("---------食料品購入---------")
product_name=input('商品の名前を入力してください: ')
price=float(input('単価: '))
tax_rate=0.08
qty=float(input('数量: '))
total_price=(1+tax_rate)*price*qty
print(f'{product_name} 合計 {total_price:.0f}円 \n 単価 {price}円 税商品{tax_rate} 数量 {qty} ')
print("--------日常品をこうにゅう----------")
product_name=input('商品の名前を入力してください: ')
price=float(input('単価: '))
tax_rate=0.08
qty=float(input('数量: '))
total_price=(1+tax_rate)*price*qty
print(f'{product_name} 合計 {total_price:.0f}円 \n 単価 {price}円 税商品{tax_rate} 数量 {qty} ')