---
id: 6554a334a40edb1fb4eff827
title: Step 62
challengeType: 20
dashedName: step-62
---

# --description--

Next, inside the `else` block, declare a variable called `key_char` and assign it the value of `key` at the index `key_index` mod(`%`) the length of `key`.

# --hints--

You should declare a variable called `key_char` at the beginning of your `else` clause body.

```js
const commentless_code = __helpers.python.removeComments(code);
const {block_body} = __helpers.python.getBlock(commentless_code, "else");
assert(block_body.match(/^\s*key_char\s*=/));
```

You should assign `key[key_index % len(key)]` to your `key_char` variable.

```js
const commentless_code = __helpers.python.removeComments(code);
const {block_body} = __helpers.python.getBlock(commentless_code, "else");    
assert(block_body.match(/key_char\s*=\s*key\s*\[\s*key_index\s*%\s*len\s*\(\s*key\s*\)\s*\]/));
```

Your code contains invalid syntax and/or invalid indentation.

```js
({test: () => assert(true) })
```

# --seed--

## --seed-contents--

```py

text = 'Hello Zaira'
custom_key = 'python'

def vigenere(message, key):
    key_index = 0
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    encrypted_text = ''

    for char in message.lower():
--fcc-editable-region--        
        # Append space to the message
        if char == ' ':
            encrypted_text += char
        else:
--fcc-editable-region--        
            index = alphabet.find(char)
            new_index = (index + offset) % len(alphabet)
            encrypted_text += alphabet[new_index]
    print('plain text:', message)
    print('encrypted text:', encrypted_text)

```
