Last answered:

05 Nov 2022

Posted on:

04 Nov 2022

0

why is my coding wrong?

alphabet='abcdefghijklmnopqrstuvwxyz'
word_test='the cat sat on the map'

def encrypt(text,num):
    output= ' '
    for char in word_test:
        alpha_index = alphabet.find(char)
        def shift_amount(i):
            for i in alpha_index:
                shift_amnount= (alpha_index+num)%26
    output= output + alphabet(alpha_index+shift_amount)
    return output

2 answers ( 0 marked as helpful)
Posted on:

05 Nov 2022

0

shift_amnount= (alpha_index+num)%26   1
output= output + alphabet(alpha_index+shift_amount) 2

I think you use wrong variable (1) shift_amnount and (2) shift_amount

Posted on:

05 Nov 2022

0

thank you so much.

Submit an answer