我正在编写一个程序,以确定一个汽车销售员的利润为一辆新的或前拥有的车辆。
伪码
float。代码到目前为止
def main():
pre-owned_vehicles = float(input("Enter total profit on pre-owned vehicles sold * 0.25: "))
new_vehicles = float(input("Enter total profit on new vehicles sold * 0.35: "))
commission pre-owned sales = float(input("Enter commission pre_owned: "))
commission new sales = float(input("Enter commission new: "))
total = profit + commission
print('Pre-owned sales profit is $')
format(new sale profit, ',.2f)
main()发布于 2016-03-28 01:44:09
您正在获得一个SyntaxError,因为您不能在中间有连字符(或空格)的变量名,它认为您正在尝试减去。因此,将代码更改为:
pre-owned_vehicles = float(input("Enter total profit on pre-owned vehicles sold * 0.25: "))然后继续。
>>> foo-bar = 'foo-bar'
File "<stdin>", line 1
SyntaxError: can't assign to operator
>>> foo_bar = 'foo-bar'
>>> https://stackoverflow.com/questions/36253934
复制相似问题