select customers.* from customers inner join my_table on customers.id = my_table.list_element_id
说
salary = float(input("What is your salary?"))
if salary > 1250.00 :
new = salary*0.1
print("the increase was {}".formart(new))
if salary <= 1250.00:
new = salary*0.15
print("the increase was {}".formart(new))
答案 0 :(得分:1)
这是一个简单的错字,formart
应该是format
,缩进也很糟糕:
salary = float(input("What is your salary?"))
if salary > 1250.00 :
new = salary*0.1
print("the increase was {}".format(new))
if salary <= 1250.00:
new = salary*0.15
print("the increase was {}".format(new))
您还可以使用'%'
:
salary = float(input("What is your salary?"))
if salary > 1250.00 :
new = salary*0.1
print("the increase was %s"%(new))
if salary <= 1250.00:
new = salary*0.15
print("the increase was %s"%(new))
如果版本> pytho 3.6,则为f字符串:
salary = float(input("What is your salary?"))
if salary > 1250.00 :
new = salary*0.1
print(f"the increase was {new}")
if salary <= 1250.00:
new = salary*0.15
print(f"the increase was {new}")
或者在这种情况下最好的方法:
salary = float(input("What is your salary?"))
if salary > 1250.00 :
new = salary*0.1
print("the increase was", new)
if salary <= 1250.00:
new = salary*0.15
print("the increase was", new)