私は Python 2.7x を学ぼうとしている (2 週間くらい) 初心者です。ユーザーが食事の費用を入力し、.15 チップでいくらになるかを出力する基本的なプログラムを実行しようとしています。出力を 23.44 のようにしたい (小数点以下 2 桁を表示)
私のコード:
MealPrice = float(raw_input("Please type in your bill amount: "))
tip = float(MealPrice * 0.15,)
totalPrice = MealPrice+tip
int(totalPrice)
print "Your tip would be: ",tip
print "Yout total bill would be: ",totalPrice
私の出力: 請求額を入力してください: 22.22 あなたのチップは次のようになります: 3.333 あなたの総請求額は: 25.553