タイトルは、ユーザー入力+基本数学を使用して壁をペイントするためのコストを計算するPythonを使用して計算を試しています。現在私が抱えている問題は、ユーザーが望む塗料の品質によって総コストを計算する修飾子を追加しようとするときです。私はvauleを計算しようとしていますが、正しく出力されません
私のコード:
import string
values = dict()
for index, letter in enumerate(string.ascii_lowercase):
values[letter] = index + 1
ok = False
while not ok:
WindowH = input("Enter in numbers only the height of the window:")
try:
HW = int(WindowH)
ok = True
print (HW)
except ValueError:
print("please enter a number.")
ok = False
while not ok:
WindowL = input("Enter in numbers only the Legnth of the window:")
try:
LW = int(WindowL)
ok = True
print (LW)
except ValueError:
print("please enter a number.")
warea = LW * HW
print("%.2f" % warea)
ok = False
while not ok:
Height = input("Enter in numbers only the height of the walls:")
try:
H = int(Height)
ok = True
print (H)
except ValueError:
print("please enter a number.")
ok = False
while not ok:
Length = input("Enter in numbers only the Length of the walls:")
try:
L = int(Length)
ok = True
print (L)
except ValueError:
print("please enter a number.")
waArea = L * H
print("%.2f" % waArea)
tarea = waArea -warea
print("%.2f" % tarea)
quality = input(" which qualility of paint would you like to use 1.75, 1.00 or 0.80? [ 1.75 =luxury 1.00=sandard 0.85=economy [please not that Luxury quality costs £1.75 per square metre, Standard quality which costs £1.00 per square metre, Economy quality which costs £0.80 per square metre]")
q = int(quality)
cost = q * tarea
print("%.2f" % cost)
私は問題を抱えていintrestの主なポイントは次のとおりです。
それは壁の総寸法を取りますが、ために多人数を行うことはありませんtarea = waArea -warea
print("%.2f" % tarea)
quality = input(" which qualility of paint would you like to use 1.75, 1.00 or 0.80? [ 1.75 =luxury 1.00=sandard 0.85=economy [please not that Luxury quality costs £1.75 per square metre, Standard quality which costs £1.00 per square metre, Economy quality which costs £0.80 per square metre]")
q = int(quality)
cost = q * tarea
print("%.2f" % cost)
塗料の品質は=コストとなります。