I have no idea how I am supposed to use proper indentation here. I have read some articles and watched a few videos and still don’t see where my indentation is incorrect.
Any advice helps.
Your code so far
# User Editable Region
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)
# 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/121.0.0.0 Safari/537.36
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 50
for this in that:
if this == True:
do that
else:
do this
A function:
def function():
this is inside the function
this is inside the function
this is inside the function
this is inside the function
this is outside the function
All together:
def function():
this is inside the function
for this in that:
if this == True:
do that
else:
do this
this is inside the function
this is outside the function
These examples are extremely helpful, although they cannot be applied to step 50. I am being asked to define a function called caesar, but there is no code that goes in that function… so how am I supposed to do proper indentation if there is no code below my defined function?
I’ve reset my lesson, and added the defined function. I have tried indented all types of scenarios below the defined function. I can’t figure this one out, not unless the defined code has some type of code, which they don’t ask me to do.
Going off your above samples, there should be no indentation after my defined function because everything after my defined function is outside of the function.