When provided with a letter, return its position in the alphabet.

Input :: "a"

Ouput :: "Position of alphabet: 1"

`This kata is meant for beginners. Rank and upvote to bring it out of beta`

Difficulty: introductory

Starter code:

def position(alphabet):
	

Solutions:
def position(alphabet):
    return "Position of alphabet: {}".format(ord(alphabet) - 96)

def position(alphabet):
    return "Position of alphabet: %s" % ("abcdefghijklmnopqrstuvwxyz".find(alphabet) + 1)

from string import ascii_lowercase
def position(char):
    return "Position of alphabet: {0}".format(
        ascii_lowercase.index(char) + 1)

def position(letter):
    return "Position of alphabet: %d" % (ord(letter) - 96)

def position(alpha):
    return f"Position of alphabet: {ord(alpha)-96}"

from string import lowercase

def position(letter):
    return 'Position of alphabet: %d' % (
        1 + lowercase.index(letter))


def position(alphabet):
    return 'Position of alphabet: ' + str(ord(alphabet) - ord('a') + 1)

position = lambda a: 'Position of alphabet: {}'.format(ord(a) - 96)

# def position(alphabet):
#     return 'Position of alphabet: {}'.format(ord(alphabet) - 96)


def position(a):
    return f"Position of alphabet: {ord(a) - 96}"

position = lambda a: "Position of alphabet: {}".format(ord(a)-96)

def position(alphabet):
    return "Position of alphabet: {}".format(ord(alphabet.lower()) - 96)

def position(a):
    return 'Position of alphabet: {}'.format(ord(a) - 96)

import string

def position(alphabet):
    return f'Position of alphabet: {string.ascii_letters.index(alphabet.lower()) + 1}'

def position(alphabet):
    abc = "abcdefghijklmnopqrstuvwxyz"
    pos = abc.index(alphabet) + 1
    return "Position of alphabet: " + str(pos)

def position(alphabet):
    alph_list = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
    for i in range(0, 26):
        if alphabet == alph_list[i]:
            j = i + 1
            return "Position of alphabet: " + str(j)

position=lambda l: "Position of alphabet: "+str("abcdefghijklmnopqrstuvwxyz".index(l)+1)

def position(alphabet):
    return "Position of alphabet: " + str(ord(alphabet) - 96)

import string

position = lambda a: 'Position of alphabet: {}'.format(string.ascii_lowercase.index(a) + 1)

def position(alphabet):
    return f"Position of alphabet: {ord(alphabet[0]) - 96}"

abc = {"a": "1", "b": "2", "c": "3", "d": "4", "e": "5", "f": "6", "g": "7",
            "h": "8", "i": "9", "j": "10", "k": "11", "l": "12", "m": "13", "n": "14",
            "o": "15", "p": "16", "q": "17", "r": "18", "s": "19", "t": "20", "u": "21",
            "v": "22", "w": "23", "x": "24", "y": "25", "z": "26"}


def position(alphabet):
    return f'Position of alphabet: {abc.get(alphabet)}'

def position(ch):
    return f"Position of alphabet: {ord(ch)-ord('a')+1}"

def position(alphabet):
    result = ord(alphabet) - 96
    return f'Position of alphabet: {result}'

import string
def position(alphabet):
    d={}
    s=string.ascii_lowercase
    c=1
    for i in s:
        d[i]=c
        c+=1
    return f'Position of alphabet: {d.get(alphabet)}'

def position(alphabet):
    print(ord('a'))
    return f'Position of alphabet: {ord(alphabet)-96}'

def position(a):
    return f'Position of alphabet: {"abcdefghijklmnopqrstuvwxyz".index(a)+1}'

def position(letter):
    import string
    alpha = string.ascii_lowercase
    
    return 'Position of alphabet: {}'.format(alpha.index(letter)+1)

def position(alphabet):
    dict = {
        'a': 1,
        'b': 2,
        'c': 3,
        'd': 4,
        'e': 5,
        'f': 6,
        'g': 7,
        'h': 8,
        'i': 9,
        'j': 10,
        'k': 11,
        'l': 12,
        'm': 13,
        'n': 14,
        'o': 15,
        'p': 16,
        'q': 17,
        'r': 18,
        's': 19,
        't': 20,
        'u': 21,
        'v': 22,
        'w': 23,
        'x': 24,
        'y': 25,
        'z': 26
    }
    
    return f'Position of alphabet: {dict.get(alphabet)}'

from string import ascii_lowercase as lc 
def position(alphabet):
    return f'Position of alphabet: {lc.find(alphabet.lower()) + 1}'

def position(alphabet):
    alph = list('abcdefghijklmnopqrstuvwxyz')
    return f'Position of alphabet: {alph.index(alphabet)+1}'

def position(alphabet):
    a = 'abcdefghijklmnopqrstuvwxyz'
    x = list(map(lambda x: a[x],range(len(a)))).index(alphabet)+1
    return "Position of alphabet: "+str(x)

def position(a):
    return "Position of alphabet: "+str(list("abcdefghijklmnopqrstuvwxyz").index(a)+1)

def position(alphabet):
    ABC = {"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9,"j":10,"k":11,"l":12,"m":13,"n":14,
           "o":15,"p":16,"q":17,"r":18,"s":19,"t":20,"u":21,"v":22,"w":23,"x":24,"y":25,"z":26,}
    for i in ABC:
        if i == alphabet:
            return str("Position of alphabet: ") + str(ABC[alphabet])

import string
def position(alphabet):
    dictionary = {'a':'Position of alphabet: 1',
                'b': "Position of alphabet: 2",
                'c': 'Position of alphabet: 3',
                'd': 'Position of alphabet: 4',
                'e': 'Position of alphabet: 5',
                'f': "Position of alphabet: 6",
                'g': "Position of alphabet: 7",
                'h': 'Position of alphabet: 8',
                'i': 'Position of alphabet: 9',
                'j': 'Position of alphabet: 10',
                'k': "Position of alphabet: 11",
                'l': 'Position of alphabet: 12',
                'm': "Position of alphabet: 13",
                'n': 'Position of alphabet: 14',
                'o': 'Position of alphabet: 15',
                'p': 'Position of alphabet: 16',
                'q': "Position of alphabet: 17",
                'r': "Position of alphabet: 18",
                's': 'Position of alphabet: 19',
                't': 'Position of alphabet: 20',
                'u': 'Position of alphabet: 21',
                'v': "Position of alphabet: 22",
                'w': 'Position of alphabet: 23',
                'x': 'Position of alphabet: 24',
                'y': 'Position of alphabet: 25',
                'z': "Position of alphabet: 26"}
    
    return dictionary[alphabet]


def position(letter):
    alpahabet=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
    for i in range(0,len(alpahabet)):
        if alpahabet[i] ==letter:
            return "Position of alphabet: "+str(i+1)

position = lambda letter: f"Position of alphabet: {'abcdefghijklmnopqrstuvwxyz'.index(letter) + 1}"

def position(alphabet):
    char = ['a','b','c','d','e','f','g','h','i','j','k','l',
               'm','n','o','p','q','r','s','t','u','v','w','x','y','z']
    
    nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 
17, 18, 19, 20, 21, 22, 23, 24, 25, 26]
    
    char_num = list(zip(char,nums))
    
    for i,j in char_num:
        if i == alphabet:
            return "Position of alphabet: "+ str(j)
            


def position(alphabet):
    a_l='abcdefghijklmnopqrstuvwxyz'
    return f'Position of alphabet: {a_l.index(alphabet)+1}'



def position(alphabet):
    alpha = ['', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
    
    if alphabet in alpha:
        return f"Position of alphabet: {alpha.index(alphabet)}"
    



import string
def position(alpha):
    alphabet = string.ascii_lowercase
    return f"Position of alphabet: {alphabet.find(alpha) + 1}"


import string
def position(pos):
    alphabet = string.ascii_lowercase
    return f"Position of alphabet: {alphabet.index(pos) + 1}"

alp = 'abcdefghijklmnopqrstuvwxyz'

def position(alphabet):
    return f"Position of alphabet: {alp.index(alphabet)+1}"

def position(letter):
    msg = 'Position of alphabet: '
    return f'{msg}{"abcdefghijklmnopqrstuvwxyz".find(letter) + 1}'

def position(alphabet):
    alphabet.lower()
    al='abcdefghijklmnopqrstuvwxyz'
    ind = al.index(alphabet)
    return "Position of alphabet: {}".format(ind+1)

def position(alphabet):
    import string
    a = string.ascii_lowercase.index(alphabet)
    b = a + 1
    c = str(b)
    return ("Position of alphabet: " + (c))

def position(char):
    return 'Position of alphabet: {}'.format(ord(char) - 96)

def position(alphabet):
    alph = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
    for i in range(26):
        if alph[i] == alphabet: return "Position of alphabet: " + str(i+1)

def position(alphabet):
    dict_alpha = {
        "a" : 1,
        "b" : 2,
        "c" : 3,
        "d" : 4,
        "e" : 5,
        "f" : 6,
        "g" : 7,
        "h" : 8,
        "i" : 9,
        "j" : 10,
        "k" : 11,
        "l" : 12,
        "m" : 13,
        "n" : 14,
        "o" : 15,
        "p" : 16,
        "q" : 17,
        "r" : 18,
        "s" : 19,
        "t" : 20,
        "u" : 21,
        "v" : 22,
        "w" : 23,
        "x" : 24,
        "y" : 25,
        "z" : 26
    }
    pos = dict_alpha.get(alphabet)
    return f'Position of alphabet: {pos}'

def position(alphabet):
    x = "Position of alphabet: " + (str(ord(alphabet)-96))
    return x

def position(ch):
    for i in range(26):
        if ch.lower() == "abcdefghijklmnopqrstuvwxyz"[i]: return f"Position of alphabet: {i+1}"
    return False        

def position(alphabet):
    position=ord(alphabet.lower())-96
    return f"Position of alphabet: {position}"

def position(alphabet):
    
    abcd = "abcdefghijklmnopqrstuvwxyz"
    
    pos = abcd.index(alphabet)
    
    return "Position of alphabet: {}".format(pos+1)

import string
def position(alphabet):
    ab = dict(zip(string.ascii_lowercase, range(1,27)))
    return f"Position of alphabet: {ab.get(alphabet)}"

def position(c):
    return f"Position of alphabet: {ord(c.lower()) - 96}"

def position(alphabet):
    import string
    x=list(string.ascii_lowercase)
    return f'Position of alphabet: {x.index(alphabet)+1}'

alf = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
    'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']    
def position(alphabet):
    nonlocal alf   
    return f'Position of alphabet: {alf.index(alphabet) + 1}'
    


def position(alphabet):
    import string
    characters = {char: str(idx) for idx, char in enumerate(string.ascii_lowercase, 1)}
    return f"Position of alphabet: {characters[alphabet]}"


def position(alphabet):
    num = (ord(alphabet))
    num -= 96
    return f"Position of alphabet: {num}"

letters ={
          "a": 1, 
          "b": 2,
          "c": 3,
          "d": 4,
          "e": 5,
          "f": 6,
          "g": 7,
          "h": 8, 
          "i": 9,
          "j": 10,
          "k": 11, 
          "l": 12,
          "m": 13,
          "n": 14,
          "o": 15,
          "p": 16,
          "q": 17,
          "r": 18,
          "s": 19,
          "t": 20,
          "u": 21,
          "v": 22,
          "w": 23,
          "x": 24,
          "y": 25,
          "z": 26
          }

def position(alphabet):
    if alphabet in letters:
        return f"Position of alphabet: {letters.get(alphabet)}"


from string import ascii_lowercase as al

def position(alphabet):
    return f'Position of alphabet: {[pos for pos, x in enumerate(al, 1) if x == alphabet.lower()][0]}'

def position(alphabet):
    index_alphabet = "abcdefghijklmnopqrstuvwxyz"
    return "Position of alphabet: " + str(index_alphabet.index(alphabet) + 1)


def position(alphabet):
    alph = 'abcdefghijklmnopqrstuvwxyz'
    return f'Position of alphabet: {alph.index(alphabet) + 1}'

def position(alphabet):
    alpha = '1abcdefghijklmnopqrstuvwxyz'
    return "Position of alphabet: " + str(alpha.find(alphabet))

def position(alphabet):
    letters = [0,"a", "b", "c", "d", "e", "f", "g", "h", 
               "i", "j", "k", "l", "m", "n", "o", "p", 
               "q", "r", "s", "t", "u", "v", "w", "x", 
               "y", "z"]
    return "Position of alphabet: {}".format(letters.index(alphabet.lower()))

position = lambda alphabet: f'Position of alphabet: {ord(alphabet) - 96}'

def position(letter):
  print (letter)
  alph='abcdefghijklmnopqrstuvwxyz'
  for i, elem in enumerate(alph):
    if elem==letter:
      return f"Position of alphabet: {i+1}"


def position(alphabet):
    r= (ord(alphabet)-96)
    return "Position of alphabet: {}".format(r)
    pass

def position(alphabet):
    return "Position of alphabet: {}".format(str(ord(alphabet)+1-ord('a')))

position=lambda s:f"Position of alphabet: {__import__('string').ascii_letters.index(s)+1}"

import string

def position(alphabet):
    dict_alphabet = dict(zip(string.ascii_lowercase,range(1,27)))
    return f'Position of alphabet: {dict_alphabet[alphabet]}'

def position(alphabet):
    alp =['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
    n = 0
    for i in range(0,26):
       if alp[i] == alphabet:
          a = int(alp.index(alp[i])) + 1
    return "Position of alphabet: {}".format(a)

def position(alphabet):
    a = ' abcdefghijklmnopqrstuvwxyz'
    return 'Position of alphabet: ' + str(a.find(alphabet))

def position(a):
    return "Position of alphabet: {}".format(ord(a)-ord('a')+1)

def position(letter: str) -> str:
    return f"Position of alphabet: {ord(letter) - 96}"


def position(alphabet):
    abc = 'abcdefghijklmnopqrstuvwxyz'
    return f'Position of alphabet: {abc.index(alphabet)+1}'

import string

def position(alphabet):
    return f"Position of alphabet: {string.ascii_lowercase.index(alphabet.lower()) + 1}"

position = lambda c: f'Position of alphabet: {ord(c) - 96}'

def position(alphabet):
   whole_alphabet = {
   "a" : 1 ,
   "b" : 2 ,
   "c" : 3 ,
   "d" : 4 ,
   "e" : 5 ,
   "f" : 6 ,
   "g" : 7 ,
   "h" : 8 ,
   "i" : 9 ,
   "j" : 10 ,
   "k" : 11 ,
   "l" : 12 ,
   "m" : 13 ,
   "n" : 14 ,
   "o" : 15 ,
   "p" : 16 ,
   "q" : 17 ,
   "r" : 18 ,
   "s" : 19 ,
   "t" : 20 ,
   "u" : 21 ,
   "v" : 22 ,
   "w" : 23 ,
   "x" : 24 ,
   "y" : 25 ,
   "z" : 26
   }
   position = whole_alphabet[alphabet]

   return f"Position of alphabet: {whole_alphabet[alphabet]}"

print((position("h")))


def position(alphabet):
    pos = ord(alphabet) - ord('a') + 1
    return f'Position of alphabet: {pos}'

def position(alphabet):
    return "Position of alphabet: %i" % (ord(alphabet.lower()) - 96)

def position(alphabet):
    return "Position of alphabet: "+str(ord(alphabet)%ord('a')+1)

import string

def position(alphabet):
    return f'Position of alphabet: {string.ascii_letters.index(alphabet)+1}'

def position(alphabet):
    
    txt = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    
    x = txt.lower().find(alphabet) + 1
    
    solution =  'Position of alphabet: {}'
    
    return solution.format(x)

def position(alphabet):
    position = ord(alphabet) - 96
    return f'Position of alphabet: {position}'

def position(alphabet):
    abc=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
    return "Position of alphabet: "+ str(abc.index(alphabet)+1)

def position(alphabet):
    a=" abcdefghijklmnopqrstuvwxyz"
    return f"Position of alphabet: {a.index(alphabet)}"

from string import ascii_lowercase as alphabet
def position(letter):
    return 'Position of alphabet: {}'.format(alphabet.find(letter) + 1)

def position(a):
    g = 'abcdefghijklmnopqrstuvwxyz'
    return "Position of alphabet: " + str(g.find(a)+1)

def position(alphabet):
    a = list("abcdefghijklmnopqrstuvwxyz")
    return f"Position of alphabet: {a.index(alphabet)+1}"

def position(letter):

    return f"Position of alphabet: {ord(letter) - 96}"

import string

def position(alphabet):
    al = list(enumerate(list(string.ascii_lowercase),1))
    d = {}
    for e in al:
        x = {e[1]: e[0]} 
        d.update(x)
    return 'Position of alphabet: ' + str(d[alphabet])

def position(alphabet):
    return "Position of alphabet: {0}".format('abcdefghijklmnopqrstuvwxyz'.index(alphabet) + 1)

def position(a):
    pos = ord(a) - ord("a") + 1
    return 'Position of alphabet: {}'.format(pos)

def position(alphabet):
    value = ord(alphabet)-96
    print(value)
    return "Position of alphabet: " + str(value)


def position(alphabet):
    letters = '0abcdefghijklmnopqrstuvwxyz'
    return 'Position of alphabet: ' + str(letters.index(alphabet))

def position(l): return "Position of alphabet: " + str(ord(l.lower())-96)

def position(alphabet):
    dictionary = {chr(96+i) : i for i in range (1, 27)}
    
    return "Position of alphabet: " + str(dictionary[alphabet])

position=lambda a:"Position of alphabet: "+ str("0abcdefghijklmnopqrstuvwxyz".index(a))

def position(s):
    return 'Position of alphabet: '+str(ord(s) - 96)

import string 
def position(a):
    return "Position of alphabet: {}".format(list(string.ascii_lowercase).index(a)+1)

def position(letter):
    return f"Position of alphabet: {ord(letter)-ord('a')+1}"