wap to shift the alphabets N number of times in FORWARD mode,where N is the length of a particular word in the given string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

wap to shift the alphabets N number of times in FORWARD mode,where N is the length of a particular word in the given string

Input- ABCDX Output- FGHIZ Input1-Hi Hell Output1- jk Lipp when the last alphabet X needs to be shifted 5 times forward but the aphabet end at Z,X is replaced by Z

7th May 2021, 6:33 AM
Tøxïç Skíñfíé 😈
Tøxïç Skíñfíé 😈 - avatar
11 Answers
0
Answer
3rd Jun 2022, 8:28 AM
japa jyothireddy
japa jyothireddy - avatar
0
3rd Jun 2022, 10:00 AM
S Vasanth
S Vasanth - avatar
0
10th Jun 2022, 9:09 AM
Kanala Gopichandrasekharreddy
Kanala Gopichandrasekharreddy - avatar
0
B_H_S_DIKO AISA H GYAN MAT PELO YHA FALTU KA MKL, 1 SAAL PHLE KA QUESTION MUJHE JHAMT MATLAB NI AB ISKE SOLUTION SE,AB BAR BAR LIKE OR ANSWER DEKE ISKA MUJHE NOTIFICATION MT BHJO,OR MKL TU ITNA HI GYANI H TO JAKE APNA PDH YHA KYA BAKCHOMDI KRRA KI IF HOMEWORK THEN DONE URSELF,RAMNDI ADMI KHUD HI KRNA HOTA TO YHA Q POST KRTA MAI CHUMTTAD.
10th Jun 2022, 3:16 PM
Tøxïç Skíñfíé 😈
Tøxïç Skíñfíé 😈 - avatar
0
Abe tu kisko bolra sidha baat karna tu bhi idhar bakchodi mat kar aata hai to bata varna chup baith
22nd Jul 2022, 10:02 AM
Sohel Mulla
Sohel Mulla - avatar
0
Post dkh choti lulli ke tere papa ka post h
22nd Jul 2022, 10:04 AM
Tøxïç Skíñfíé 😈
Tøxïç Skíñfíé 😈 - avatar
0
Abe ab jyada mat bol mere ko bhi aata
22nd Jul 2022, 10:11 AM
Sohel Mulla
Sohel Mulla - avatar
0
class UserMainCode(object): @classmethod def returnModifiedSentence(cls, input1): def shift_alphabets(word): shifted_word = "" for char in word: if char.isalpha(): ascii_value = ord(char) shifted_ascii = ascii_value + len(word) if shifted_ascii > 122: shifted_ascii = 122 elif shifted_ascii > 90 and shifted_ascii < 97: shifted_ascii = 90 if char.islower(): shifted_ascii = (shifted_ascii - 97) % 26 + 97 else: shifted_ascii = (shifted_ascii - 65) % 26 + 65 shifted_word += chr(shifted_ascii) else: shifted_word += char return shifted_word words = input1.split() shifted_words = [shift_alphabets(word) for word in words] shifted_string = " ".join(shifted_words) return shifted_string # Example usage string = "Hi Hell" shifted_string = UserMainCode.returnModifiedSentence(string) print("Shifted string:", shifted_string)
16th Jun 2023, 3:09 PM
Divine Steve
Divine Steve - avatar
- 1
wap to shift the alphabets N number of times in FORWARD mode,where N is the length of a particular word in the given string Input- ABCDX Output- FGHIZ Input1-Hi Hell Output1- jk Lipp when the last alphabet X needs to be shifted 5 times forward but the aphabet end at Z,X is replaced by Z
3rd Jun 2022, 8:28 AM
japa jyothireddy
japa jyothireddy - avatar
- 1
3rd Jun 2022, 10:00 AM
S Vasanth
S Vasanth - avatar
- 3
10th Jun 2022, 9:09 AM
Kanala Gopichandrasekharreddy
Kanala Gopichandrasekharreddy - avatar