Learn String Manipulation by Building a Cipher - Step 48

Tell us what’s happening:

i have printed after the for loop please can anyone tell what did i do wrong

Your code so far


# User Editable Region

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

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

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 48

Right before the print call, add another one

Good, but your placement is not correct. “Right before the print call” should be the line immediately above the existing print

Tell us what’s happening:

so i have created the first print but after that step but now that ‘exsisting step is nowhere to be found’

Your code so far


# User Editable Region

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

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

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 48

Your new print line seems to be 5 lines above this one print('encrypted text:', encrypted_text). It should be on the previous line.

what do u mean by previous line

the line above the existing print

1 Like

Tell us what’s happening:

i did what u said what did i do wrong i think my position is wrong

Your code so far


# User Editable Region

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

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

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 48

It’s still 6 lines above. The two print lines should be together.

code
code
print()  <--new print on previous line immediately above
print()  <--existing print