PY4E-练习题疑问


请教各位,语句是哪里有问题?(附在最下)
用的是Jupiter notebook
检查过每一个符号,确定都是半字符

题目 Exercise 1: Rewrite your pay computation to give the employee 1.5 times the hourly rate for hours worked above 40 hours.

img

练习如下,请多指点,靴靴!

img

 

else语句不应该跟随条件表达式,应该改为elif或其他条件语句来处理,试试这个:

if hour <= 40:
    pay = hour * 18
else:
    if hour > 40:
        pay = (hour - 40) * 1.5 * 18 + 40 * 18 + 48 + 10