Learn String Manipulation by Building a Cipher - Step 24

Tell us what’s happening:

Describe your issue in detail here.
i need help here i got stuck in this and previous step 23

Your code so far


/* User Editable Region */

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

for char in text:
    index = alphabet.find(char)
    print('character',char,'index',index)

/* 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/120.0.0.0 Safari/537.36 Edg/120.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 24

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.

Hi @akhilakki123

You’re pretty close! So close that it’s almost hard to help without spoiling the solution.

Add a second argument to print(char) so that it prints the character and its index inside the alphabet.

Previously you had print(char) and that was printing 1 argument (char); it’s now asking you to print a 2nd argument (index).

Good luck!

1 Like

hi @akhilakki123
to add another argument to the print() function and separate the two with a coma like the below.
print(char, index)