+ 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
12 odpowiedzi
0
Answer
0
0
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.
0
Abe tu kisko bolra sidha baat karna tu bhi idhar bakchodi mat kar aata hai to bata varna chup baith
0
Post dkh choti lulli ke tere papa ka post h
0
Abe ab jyada mat bol mere ko bhi aata
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)
- 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
- 1
- 3