Learn String Manipulation by Building a Cipher - Step 35

Tell us what’s happening:

step 35

I changed the loop correctly but the code does not pass.
I have to change print(new_char) in print(‘char:’, char, ‘new_char:’, new_char)

Your code so far


# User Editable Region

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

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

# User Editable Region

Your browser information:

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

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 35

Your solution works from my end. Please try one of the following steps to move forward.

Click on the “Restart Step” button and force a refresh of your page with CTRL + F5 then try to paste the code in again.

or - Try the step in incognito or private mode.

or - Disable any/all extensions that interface with the freeCodeCamp website (such as Dark Mode, Ad Blockers, or Spellcheckers), and set your browser zoom level to 100%. Both of these factors can cause tests to fail erroneously.

or - Ensure your browser is up-to-date or try a different browser.

I hope one of these will work for you.

Hi @collari.f, welcome to the community! :blush:

I noticed two small issues in your code:

  1. You should include a semi-colon inside 'char' as the lesson specifically asked for that format.
  2. You’ve written 'new_char:' with an underscore, but the lesson seems to ask without it (use a space instead of an underscore).

Just fix those two formatting details and it should work perfectly!

No no, ho corretto me non va :frowning:

I’ll try all. thank you :slight_smile:

yes, the matter was the underscore , thank you! :orange_heart:

1 Like