Last answered:

11 Nov 2022

Posted on:

12 Oct 2022

0

My complete function returns only a single letter instead of the complete word.

Dear Sir,

As seen below, when I run this function it returns just a single letter 't'. I have changed my shift to a different word and tried it will not solve the problem. I have increased my required shift to 30 but this problem still persist. I think it should be with the code but I have gone through the code more than twice unfortunately I dont seem to find the problem. Please I need your help.

image.png

2 answers ( 0 marked as helpful)
Instructor
Posted on:

12 Oct 2022

0

Hey Martin,

Thank you for reaching out!

I don't immediately see any issue with the code. Please, go through the following points which I can't see on the screenshot:
1. Make sure your alphabet variable is defined as follows:

alphabet = 'abcdefghijklmnopqrstuvwxyz'

2. Make sure your shift_amount() function is defined as follows:

def shift_amount(i):
    return i%26

3. Please, restart the kernel and run everything anew. Make sure you are not defining the shift variable anywhere else in your code. You can restart the kernel from here:
image.png
Let me know if the problem persists.

Kind regards,
365 Hristina

Posted on:

11 Nov 2022

0

return out_string is not aligned the way it should in your code

check that it is rightly aligned, which is, it has to be in the same alignment with for, not in alignment with if else

I hope this helps!

Submit an answer