Skip to main content
deleted 1 character in body
Source Link

Python 2, 48 43 bytes

Returns 0 on error.

lambda m,n:m/n and[m/n]*(n-m%n)+m%n*[m/n+1]

Try it online!


41 bytes (with @xnor's trick)

Throws ValueErrorNameError on error.

lambda m,n:[m/n or _]*(n-m%n)+m%n*[m/n+1]

Try it online!

Python 2, 48 43 bytes

Returns 0 on error.

lambda m,n:m/n and[m/n]*(n-m%n)+m%n*[m/n+1]

Try it online!


41 bytes (with @xnor's trick)

Throws ValueError on error.

lambda m,n:[m/n or _]*(n-m%n)+m%n*[m/n+1]

Try it online!

Python 2, 48 43 bytes

Returns 0 on error.

lambda m,n:m/n and[m/n]*(n-m%n)+m%n*[m/n+1]

Try it online!


41 bytes (with @xnor's trick)

Throws NameError on error.

lambda m,n:[m/n or _]*(n-m%n)+m%n*[m/n+1]

Try it online!

deleted 1 character in body
Source Link

Python 2, 48 4543 bytes

Returns 0 on error.

lambda m,n:m/n and[m/n+1]*n]*(n-m%n)+[m+m%n*[m/n]*n+1]

Try it online!


41 bytes (with @xnor's trick)

Throws ValueError on error.

lambda m,n:[m/n or _]*(n-m%n)+m%n*[m/n+1]

Try it online!Try it online!

Python 2, 48 45 bytes

Returns 0 on error.

lambda m,n:m/n and[m/n+1]*(m%n)+[m/n]*(n-m%n)

Try it online!

Python 2, 48 43 bytes

Returns 0 on error.

lambda m,n:m/n and[m/n]*(n-m%n)+m%n*[m/n+1]

Try it online!


41 bytes (with @xnor's trick)

Throws ValueError on error.

lambda m,n:[m/n or _]*(n-m%n)+m%n*[m/n+1]

Try it online!

deleted 3 characters in body
Source Link

Python 2, 4848 45 bytes

Returns 0 on error.

lambda m,n:m/n and[m/n+n+1]*(i<m%nm%n)for i in range+[m/n]*(n-m%n)]

Try it online!Try it online!

Python 2, 48 bytes

Returns 0 on error.

lambda m,n:m/n and[m/n+(i<m%n)for i in range(n)]

Try it online!

Python 2, 48 45 bytes

Returns 0 on error.

lambda m,n:m/n and[m/n+1]*(m%n)+[m/n]*(n-m%n)

Try it online!

Source Link
Loading