Hi guys, and again got stuck here where the condition is:
Give message and offset values, by passing text and shift as arguments to the caesar function call.
I replaced the Text and shift variable names by message and offset above the fundction caesar, holding the old values however, system doesn’t allow pass me throw sending the error: You should pass text and shift as the arguments to your function call.
Thank you in advance for your help
Your code so far
/* User Editable Region */
message = 'Hello Zaira'
offset = 3
def caesar(message, offset):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
for char in message.lower():
if char == ' ':
encrypted_text += char
else:
index = alphabet.find(char)
new_index = (index + offset) % len(alphabet)
encrypted_text += alphabet[new_index]
print('plain text:', message)
print('encrypted text:', encrypted_text)
caesar()
/* 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
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 50
Sorry, looks like cannot get the point.
Before calling the function ceaser() we can also add the message and offset variables assigning to them the old or new values. did you mean that or anything else ?
Here you are calling the caesar function with no arguments. It has nothing to pass, nothing to process.
Here I call a function called pasta with 2 arguments to pass on and process.
pasta("Hello there", 15);
def caesar(message, offset):
Here you have defined caeser to accept 2 arguments and assign them to the variables message and offset for further processing in the body of the function