Given some positive integers, I wish to print the integers such that all take up the same width by adding a minimum number of leading zeroes. No leading zeroes shall be added to the largest integer.

For example, given `1, 23, 2, 17, 102`, I wish to print out these numbers as follows:

```python
001
023
002
017
102
```

Write a function `print_nums(n1, n2, n3, ...)` that takes a variable number of arguments and returns the string to be printed out.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def print_nums(*args):
	

Solutions:
def print_nums(*arr):
	if not arr:
		return ''
	ln = len(str(max(arr)))
	return '\n'.join((str(c).zfill(ln) for c in arr))


def print_nums(*num):
	return '\n'.join([str(x).zfill(len(str(max(num)))) for x in num])


def print_nums(*args):
	return '\n'.join(('{:0{}}'.format(n, len(str(max(args)))) for n in args)) if args else ''


def print_nums(*args):
	return '\n'.join(['0' * (len(str(max(args))) - len(str(x))) + str(x) for x in args])


print_nums = lambda *a: '\n'.join(('%0*d' % (len(str(max(a))), n) for n in a))


def print_nums(*args):
	try:
		fmt = '{{:0>{}}}'.format(len(str(max(args)))).format
	except ValueError:
		return ''
	return '\n'.join((fmt(a) for a in args))


def print_nums(*nums):
	l = len(str(max(nums, default=0)))
	return '\n'.join((f'{n:0{l}d}' for n in nums))


def print_nums(*args):
	z = len(str(max(args))) if args else 0
	return '\n'.join((str(n).zfill(z) for n in args))


def print_nums(*args):
	width = max((len(str(num)) for num in args), default=0)
	return '\n'.join(('{:0{}d}'.format(num, width) for num in args))