我正在编写一个程序来确定新车或二手车的汽车销售员利润。
伪代码
启动程序
营业员在二手车上获得25%的经销商利润。
销售人员获得35%的经销商利润
输入所售二手车的经销商利润总额。
输入新车销售的总经销商利润。
输入类型应为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()
答案 0 :(得分:0)
你得到一个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'
>>>