PLs find what is the bug in Python code

k = value of rotation
s = input string

====================

def caesarCipher(s, k):

st=""

for i in s:
    
    if i>='a' and i<='z':
        if ord(i)+k <=122:
            st+=chr(ord(i)+k)
        else:
            st+=chr(ord(i)+k-122+96)
    elif i>='A' and i<='Z':
        if ord(i)+k <=90:
            st+=chr(ord(i)+k)
        else:
            st+=chr(ord(i)+k-90+64)
    else:
        st+=i

return st

hello @prerak_semwal

here in the forum code indentation is not preserved.
pls save ur code here https://ide.codingblocks.com/ and share its link.

also please mention some sample input and output

This is on hackerrank where I’m getting error on 7 test cases and correct on other cases.
However this gives some weird error on coding blocks ide

yeah becuase they are writting in file (line 34 onwards are for the same thing).

if u can share its link with me that will be convenient for both of us.

@aman212yadav

I don’t think you will be able to access question…It’s given by my college for practice ( we are freshers )

no issue, i will try to debug it.

@aman212yadav

total test cases - 11

wrong - 7

@prerak_semwal
check now->

26 shift is equivalent to 0 shift , thats why i took mod with 26

1 Like

@aman212yadav
ohhh…thnks

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.