Skip to content

lame/InsureMonkeyInterview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Insure Monkey Preliminary Interview Coding Exercise

##Flatten:

print flatten([['a', 'b'], ['c', ['d', 'e',], ['f'], 'g']])
== ['a', 'b', 'c', 'd', 'e', 'f', 'g']
print flatten([['a', 'b'], 'a', ['a', 'b',], ['a'], 'b'])
== ['a', 'b', 'a', 'a', 'b', 'a', 'b']

##Comma separated values

assert comma_separated_numbers(3456) == '3,456'
assert comma_separated_numbers(987654321) == '987,654,321'
assert comma_separated_numbers(12) == '12'
assert comma_separated_numbers(12.3) == '12.3'
assert comma_separated_numbers(3456.3) == '3,456.3'

##Get Next Dates

Return a list of dates based on the following rules

  1. count: number of dates to return
  2. month offset: how many months to move ahead from base_date
  3. day cutoff: day of the month to roll over to the next month positive number means on that day of month, roll over negative number means on that number of days from the end of the month, roll over 0 means rolling over on the last day of the month
  4. day_cutoff must be taken into account before the month month_offset
  5. after rolling over to another month after base_date.month, all dates must be first of month.
print get_next_dates(date(2014, 5, 1), 2, 1, 0)
==[date(2014, 6, 1), date(2014, 7, 1)]
print get_next_dates(date(2014, 5, 2), 3, 0, 3)
==[date(2014, 5, 2), date(2014, 6, 1), date(2014, 7, 1)]
print get_next_dates(date(2014, 5, 10), 3, 0, 3)
==[date(2014, 6, 1), date(2014, 7, 1), date(2014, 8, 1)]
print get_next_dates(date(2014, 5, 30), 3, 1, -3)
==[date(2014, 7, 1), date(2014, 8, 1), date(2014, 9, 1)]
**This result seems to be incorrect, should be 2014, 7, 3 to my calculation**

##Django boilerplate

  • Write a basic set of model(s), form(s), and view(s) to handle saving multiple addresses to a user using Django ORM and class based views

About

InsureMonkey Interview Codebase

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published