我对 Python 完全陌生,我的代码有问题,我正在使用 if in 函数来做一个蔬菜水果商的计算器,当输入三个苹果被购买时,总产量为 0 英镑应该是 3.90 英镑
total = 0
print "Welcome to the green grocers, what would you like?"
print "1. Apples"
print "2: Bananas"
print "3. Oranges"
print "4. Total"
fruit = raw_input("What would you like?")
if "1" in fruit:
q = input("How many?")
total + (q*1.3)
fruit = raw_input("What would you like?")
if "2" in fruit:
g = input("How many?")
total + (g*1.5)
fruit = raw_input("What would you like?")
if "3" in fruit:
l = input("How many?")
total = (l*1.6)
fruit = raw_input("What would you like?")
if "4" in fruit:
print "Your total is £", total