Advertisement
pbeens

beens.org Text Messaging Challenge (doctest)

Apr 25th, 2013
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1. def text_messaging(texts_per_month, num_canadians):
  2.     """ (int, int) -> list
  3.  
  4.    Precondition: texts_per_month and num_canadians must be positive integers
  5.  
  6.    Per instruction at http://bit.ly/2HgbdYJ
  7.  
  8.    - total_texts should be in terms of billions (rounded to one decimal),
  9.    - millions_per_day should be in terms of millions (rounded to one decimal),
  10.    - average_canadian_text_num_per_year should be in terms of ones (rounded to
  11.      the nearest int)
  12.    - average_canadian_time_texting should be in terms of hours (rounded to one
  13.      decimal)
  14.  
  15.    >>> text_messaging(3000000000, 10000000)
  16.    [36.5, 100.0, 3600, 30.0]
  17.  
  18.    Write your code for this function below.
  19.    """
  20.  
  21.     total_texts = <insert formula here>...
  22.     millions_per_day = <insert formula here>...
  23.     average_canadian_text_num_per_year = <insert formula here>...
  24.     average_canadian_time_texting = <insert formula here>...
  25.  
  26.     return [total_texts, millions_per_day, average_canadian_text_num_per_year, average_canadian_time_texting]
  27.  
  28. if __name__ == '__main__':
  29.     import doctest
  30.     print(doctest.testmod())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement