# Learn String Manipulation by Building a Cipher - Step 75

### Tell us what’s happening:

Describe your issue in detail here.
I can’t seem to understand if I need to add more onto the if statement like seen in other people’s problems or if I need to something small to it for it to run not sure if I’m just being blind here

``````text = 'Hello Zaira!'
custom_key = 'python'

def vigenere(message, key, direction=1):
key_index = 0
alphabet = 'abcdefghijklmnopqrstuvwxyz'
final_message = ''

for char in message.lower():

/* User Editable Region */

# Append space to the message
if char.isalpha() == True:
final_message += char

/* User Editable Region */

else:
# Find the right key character to encode/decode
key_char = key[key_index % len(key)]
key_index += 1

# Define the offset and the encrypted/decrypted letter
offset = alphabet.index(key_char)
index = alphabet.find(char)
new_index = (index + offset*direction) % len(alphabet)
final_message += alphabet[new_index]

return final_message

encryption = vigenere(text, custom_key)
print(encryption)
decryption = vigenere(encryption, custom_key, -1)
print(decryption)

``````

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15`

### Challenge Information:

Learn String Manipulation by Building a Cipher - Step 75

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Hello ioanrichards90,

So the `.isalpha()` method is a method that checks whatever char or string it’s called on and it will return `True` or `False` depending on if the char is indeed a letter.

If char is a letter that entire part will just be `True` so basically your if statement is either: `if True == True` or `if False == True`. Which you know, would work. But instead just knowing if `isalpha` returns `True` or `False` is enough. Because if that method returns `True` we know it’s a letter.

im still stuck as I understand that it isalpha checks if all letters but I still don’t understand what to write to get the code to run, this Is what I tried but didn’t work can you let me know if I’m close or on the right track

if char.isalpha() == True:
if True == True
if False == True

Your if statement needs to check if char is a letter. If it is then it needs to run the code.

This works, but it’s redundant, too long. Comparing True to True. You can shorten that.

thank you I’ve got it now don’t know how I didn’t get that one haha

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.