# Task
 Given an array `arr`, find the rank of the element at the ith position.

 The `rank` of the arr[i] is a value equal to the number of elements `less than or equal to` arr[i] standing before arr[i], plus the number of elements `less than` arr[i] standing after arr[i].

# Example

 For `arr = [2,1,2,1,2], i = 2`, the result should be `3`.
 
 There are 2 elements `less than or equal to` arr[2] standing before arr[2]: 
 
 `arr[0] <= arr[2]`
 
 `arr[1] <= arr[2]`
 
 There is only 1 element `less than` arr[2] standing after arr[2]: 
 
 `arr[3] < arr[2]`
 
 So the result is `2 + 1 = 3`.
 
# Input/Output


 - `[input]` integer array `arr`

  An array of integers.

  `3 <= arr.length <= 50.`


 - `[input]` integer `i`

  Index of the element whose rank is to be found.

  
 - `[output]` an integer

  Rank of the element at the ith position.

Source: codewars | Difficulty: EASY
Tags: Ad-hoc

Starter code: def rank_of_element(arr,i):
	

Solutions:
def rank_of_element(arr, i):
	return sum((x <= arr[i] if n < i else x < arr[i] for (n, x) in enumerate(arr)))


def rank_of_element(arr, i):
	return sum((1 for item in arr[:i] if item <= arr[i])) + sum((1 for item in arr[i + 1:] if item < arr[i]))


def rank_of_element(arr, i):
	rank = 0
	for (j, value) in enumerate(arr):
		if j < i:
			if value <= arr[i]:
				rank += 1
		elif j == i:
			continue
		elif value < arr[i]:
			rank += 1
	return rank


def rank_of_element(arr, i):
	return sum((n <= arr[i] for n in arr[:i])) + sum((n < arr[i] for n in arr[i + 1:]))


rank_of_element = lambda a, i: sum((n < a[i] + (j < i) for (j, n) in enumerate(a)))


def rank_of_element(arr, i):
	return sum((v < arr[i] + (x < i) for (x, v) in enumerate(arr) if x != i))


def rank_of_element(arr, i):
	return sum((v <= arr[i] for v in arr[:i])) + sum((v < arr[i] for v in arr[i + 1:]))


def rank_of_element(arr, i):
	rank = 0
	for j in range(len(arr)):
		if j < i:
			if arr[j] <= arr[i]:
				rank += 1
		elif j > i:
			if arr[j] < arr[i]:
				rank += 1
	return rank


def rank_of_element(lst, i):
	return sum((n <= lst[i] for n in lst[:i])) + sum((n < lst[i] for n in lst[i + 1:]))