This is a follow up from my kata The old switcheroo

Write
```python
def encode(str)
```
that takes in a string ```str``` and replaces all the letters with their respective positions in the English alphabet.

```python
encode('abc') == '123'   # a is 1st in English alpabet, b is 2nd and c is 3rd
encode('codewars') == '315452311819'
encode('abc-#@5') == '123-#@5'
```
String are case sensitive.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def encode(string):
	

Solutions:
def encode(string):
	return ''.join((str(ord(c.upper()) - 64) if c.isalpha() else c for c in string))


def encode(string):
	return ''.join((str(ord(c) - 96) if c.isalpha() else c for c in string.lower()))


def encode(s):
	return ''.join((str(ord(x) - ord('a') + 1) if x.isalpha() else x for x in s.lower()))


from string import ascii_uppercase, ascii_lowercase
D = {c: str(i) for string in (ascii_uppercase, ascii_lowercase) for (i, c) in enumerate(string, 1)}

def encode(string):
	return ''.join((D.get(c, c) for c in string))


def encode(stg):
	return ''.join((str(ord(c) - 96) if 'a' <= c <= 'z' else c for c in stg.lower()))


from string import ascii_lowercase as letters

def encode(string):
	return ''.join((str(letters.find(char) + 1) if char in letters else char for char in string.lower()))


BASE = ord('A') - 1

def encode(string):
	return ''.join((str(ord(c) - BASE) if c.isalpha() else c for c in string.upper()))


def encode(string):
	string = string.lower()
	alph = 'abcdefghijklmnopqrstuvwxyz'
	st = []
	for l in string:
		if l.isalpha():
			st.append(alph.find(l) + 1)
		else:
			st.append(l)
	return ''.join(map(str, st))


import re

def encode(string):
	return re.sub('[a-z]', lambda m: str(ord(m.group()) - ord('a') + 1), string.lower())