SHARE
TWEET

Untitled

a guest Sep 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #This function converts and displays input no of days into weeks and number of days
  2. def readable_timedelta(no_days):
  3.     weeks=no_days // 7
  4.     days=no_days-(7*weeks)
  5.     return "{} week(s) and {} days(s)".format(weeks,days)
  6.    # return {'weeks':weeks,'days':days}
  7.  
  8. test1 =readable_timedelta(1)
  9. '''readable_timedelta(6)
  10. readable_timedelta(7)
  11. readable_timedelta(9)
  12. readable_timedelta(6976)'''
  13.  
  14. expected_result1 = "0 week(s) and 1 days(s)"
  15. print("expected result: {}, actual result: {}".format(expected_result1, test1))
RAW Paste Data
Top