repl.it
@EdgarOnghena/

jevaisperdreatouslescoups

Python

No description

fork
loading
Files
  • main.py
main.py
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
27
28
29
30
def swap(array: list, i1, i2):
  inter = array[i1]
  array[i1] = array[i2]
  array[i2] = inter

name = input('nom:').lower()

if len(name) % 2 == 0:
  name = name[1:]

# middle u
name_list = list(name)
name_list[len(name) // 2] = 'u'

# swap middle <-> end
swap(name_list, -1, len(name) // 2)

# shift +15
letter_pos_alph = ord(name_list[-2]) - ord('a')
letter_pos_alph += 15
letter_pos_alph %= 26
name_list[-2] = chr(ord('a') + letter_pos_alph)

# swap -2 and 1st
swap(name_list, -2, 0)

# swap #2 and -2
swap(name_list, 1, -2)

print(''.join(name_list))
Fetching token
?