Naming multiple files can be a pain sometimes.

#### Task:

Your job here is to create a function that will take three parameters, `fmt`, `nbr` and `start`, and create an array of `nbr` elements formatted according to `frm` with the starting index `start`. `fmt` will have `` inserted at various locations; this is where the file index number goes in each file. 

#### Description of edge cases:

1. If `nbr` is less than or equal to 0, or not whole, return an empty array.
2. If `fmt` does not contain `''`, just return an array with `nbr` elements that are all equal to `fmt`. 
3. If `start` is not an integer, return an empty array.

#### What each parameter looks like:

```python
type(frm) #=> str
  : "text_to_stay_constant_from_file_to_file "
type(nbr) #=> int
  : number_of_files
type(start) #=> int
  : index_no_of_first_file
type(name_file(frm, nbr, start)) #=> list
```

#### Some examples:

```python
name_file("IMG ", 4, 1)
  #=> ["IMG 1", "IMG 2", "IMG 3", "IMG 4"])
name_file("image #.jpg", 3, 7)
  #=> ["image #7.jpg", "image #8.jpg", "image #9.jpg"]
name_file("# #", 3, -2)
  #=> ["#-2 #-2", "#-1 #-1", "#0 #0"]
```

Also check out my other creations — [Elections: Weighted Average](https://www.codewars.com/kata/elections-weighted-average), [Identify Case](https://www.codewars.com/kata/identify-case), [Split Without Loss](https://www.codewars.com/kata/split-without-loss), [Adding Fractions](https://www.codewars.com/kata/adding-fractions),
[Random Integers](https://www.codewars.com/kata/random-integers), [Implement String#transpose](https://www.codewars.com/kata/implement-string-number-transpose), [Implement Array#transpose!](https://www.codewars.com/kata/implement-array-number-transpose), [Arrays and Procs #1](https://www.codewars.com/kata/arrays-and-procs-number-1), and [Arrays and Procs #2](https://www.codewars.com/kata/arrays-and-procs-number-2).

If you notice any issues or have any suggestions/comments whatsoever, please don't hesitate to mark an issue or just comment. Thanks!

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def name_file(fmt, nbr, start):
	

Solutions:
def name_file(fmt, nbr, start):
	try:
		return [fmt.replace('<index_no>', '{0}').format(i) for i in range(start, start + nbr)]
	except TypeError:
		return []


def name_file(fmt, n, start):
	return [fmt.replace('<index_no>', str(i)) for i in range(start, start + n)] if n > 0 and isinstance(n, int) and isinstance(start, int) else []


def name_file(fmt, nbr, start):
	cnt = fmt.count('<index_no>')
	fmt = fmt.replace('<index_no>', '%s')
	if nbr < 0 or not isinstance(nbr, int) or (not isinstance(start, int)):
		return []
	return [fmt % ((i,) * cnt) for i in range(start, start + nbr)]


def name_file(fmt, nbr, start):
	return [fmt.replace('<index_no>', str(i)) for i in range(start, start + nbr)] if type(start) == type(nbr) == int else []


def name_file(fmt, nbr, start):
	return [] if type(start) != int or type(nbr) != int else [fmt.replace('<index_no>', str(n)) for n in range(start, start + nbr)]


def name_file(fmt, nbr, start):
	if int(nbr) != nbr or nbr <= 0 or int(start) != start:
		return []
	fmt = [fmt for i in range(nbr)]
	num = list(range(start, start + nbr))
	for (i, f) in enumerate(fmt):
		fmt[i] = f.replace('<index_no>', str(num[i]))
	return fmt


name_file = lambda f, n, s: [f.replace('<index_no>', str(i)) for i in range(s, s + n)] if n > 0 and (type(n), type(s)) == (int, int) else []


name_file = lambda f, n, s: [f.replace('<index_no>', str(i + s)) for i in range(n)] if n % 1 == 0 and s % 1 == 0 else []