Tell us what’s happening:
can anyone help me it is showing me some indent error and not able to get it
Your code so far
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/124.0.0.0 Safari/537.36
text = 'Hello Zaira'
shift = 3
def caesar ():
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
for char in text.lower():
if char == ' ':
encrypted_text += char
else:
index = alphabet.find(char)
new_index = (index + shift) % len(alphabet)
encrypted_text += alphabet[new_index]
print('plain text:', text)
print('encrypted text:', encrypted_text)
caesar()
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 50
Learn to Code — For Free
ILM
April 24, 2024, 12:53pm
2
You should indent all the lines after shift = 3
so that they become your new function body.
You are missing one line, the last line of code is not indented
made changes but still not able to solve without calling function
ILM
April 24, 2024, 1:10pm
4
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').
1 Like
ILM
April 24, 2024, 1:11pm
5
with or without the function call your code passes, the function call is irrelevant for the tests
1 Like
Thankyou for considering my request
system
Closed
October 24, 2024, 1:17am
7
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.