0

guys, what is wrong here???? as there are two words in input the output is has only one word #encryption_program

def WordSentence(Sentence): words = Sentence.split(" ") newWords = [word[::-1] for word in words] newSentence = " ".join(newWords) result="" s=0 for i in range(len(newSentence)): char=newSentence[i] result += chr((ord(char) + s - 97) % 26 + 97) s+=1 return result Sentence = "ganesh velmani" print(WordSentence(Sentence))

19th Nov 2018, 10:25 AM
Ganesh Velmani
2 Answers
+ 3
There's nothing wrong. Like you said, it's an encryption program. So the space character is also encrypted into a different character. If you only want to encrypt the non-space characters, you could try if char == ' ': result += ' ' else: result += chr((ord(char) + s - 97) % 26 + 97)
19th Nov 2018, 10:41 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 2
And please try to share the link of your code in the playground rather than pasting the entire code over here coz no one wants to copy or write your entire code again to check that.
19th Nov 2018, 10:47 AM
ŠØŠ°Ń‰Šø Š Š°Š½Š¶Š°Š½
ŠØŠ°Ń‰Šø Š Š°Š½Š¶Š°Š½ - avatar