Skip to main content
1 of 2
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Python 3.8 (pre-release), 90 bytes

lambda s,e,n:[d for i in range((e-s).days+1)if-len(set(d:=str(s+(e-s).__class__(i))))==~n]

An unnamed function which returns a list of strings (counting/including leading zeros) that accepts three arguments:

  • s, the start - a datetime.date object;
  • e, the end - a datetime.date object; and
  • n, the number of days - an int object.

Try it online!

Note: As the function accepts datetime.date objects I have not counted the import code for that (and have worked around importing the datetime.timedelta object as it is indirectly accessible via subtraction of these input objects).

Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282