Guest User

Untitled

a guest
Jan 17th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. def report_status(scheduled_time, estimated_time):
  2.     ''' (number, number) -> str
  3.  
  4.    Return the flight status (on time, early, delayed)
  5.    for a flight that was scheduled to arrive at
  6.    scheduled_time, but is now estimated to arrrive
  7.    at estimated_time.
  8.  
  9.    Pre-condition: 0.0 <=scheduled_time <24 and
  10.    0.0 <= estimated_time < 24
  11.  
  12.    >>> report_status(14.3, 14.3)
  13.    'on time'
  14.    >>> report_status(12.5, 11.5)
  15.    'early'
  16.    >>> report_status(9.0, 9.5)
  17.    'delayed'
  18.    '''
  19.  
  20.     if scheduled_time == estimated_time:
  21.         return 'on time'
  22.     elif scheduled_time > estimated_time:
  23.         return 'early'
  24.     else:
  25.         return 'delayed'
Add Comment
Please, Sign In to add comment