-4
def report_status(scheduled_time,estimated_time):
    '''(number, number) -> str
    Return the flight status (on time, early , delayed) for a flight that was scheduled to
    arrive at scheduled_time but is now estimated to arrive at estimated_time.
pre-condition: 0.0<= scheduled_time < 24 ; 0.0<= estimated_time < 24
>>> report_status(14.3,14.3)
'on time'
>>> report_status(12.5,11.5)
'early'
>>> report_status(9.0,9.2)
'delayed'
'''
if scheduled_time == estimated_time:
   return'on time'
elif scheduled_time > estimated_time:
    return 'early'
else:
    return 'delayed'
4

1 回答 1

2

你的缩进是错误的。你拥有它的方式,没有任何代码在函数内部。从“前提条件”开始将所有内容缩进一级。

于 2013-09-13T10:26:45.213 回答