Learn String Manipulation by Building a Cipher - Step 40

Tell us what’s happening:

This does not make any sense to me, a scrub with 0 coding background.

I did literally what the instructions asked me to do.

Your code so far

# User Editable Region

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''

print(char == ' ')
for char in text.lower():
    index = alphabet.find(char)
    new_index = index + shift
    encrypted_text += alphabet[new_index]
    print('char:', char, 'encrypted text:', encrypted_text)

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 40

I’m going insane here.

I have been foiled ONCE AGAIN by confusing wording.

" At the beginning of your loop body, print the result of comparing char with a space (' '). Use the equality operator == for that."

I mistakenly thought that “at the beginning of your loop body” meant right before the for loop starts, not after the first for loop line.

The wording seems clear to me. As the “loop body” by definition is the area of the code within the loop code?

The wording is very precise, and will continue to be. It will use terms like “loop body” that you don’t fully understand yet, but now you do understand it and you’ve learned. The next time you see the phrase “At the beginning of your loop body” you’ll know exactly what it means.

If you’re new to coding it can be painful and frustrating. I would suggest to just slow down and don’t expect to zip through it easily.

1 Like