What about this one: if 0.0 < should_be_on > 24.0 or 0.0 < came_on > 24.0:
Regards, Laxmikant On 3/18/13, Santosh Kumar <sntshkm...@gmail.com> wrote: > This simple script is about a public transport, here is the code: > > def report_status(should_be_on, came_on): > if should_be_on < 0.0 or should_be_on > 24.0 or came_on < 0.0 or > came_on > 24.0: > return 'time not in range' > elif should_be_on == came_on: > return 'on time' > elif should_be_on > came_on: > return 'early' > elif should_be_on < came_on: > return 'delayed' > else: > return 'something might be wrong' > > print(report_status(123, 12.0)) > > I am looking forward of make the line starting with `if` short. > > Any tips are welcome. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list