We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6de8fb3 + 5e000b9 commit 7c818bbCopy full SHA for 7c818bb
Challenge questions/anantkaushik/challenge1.py
@@ -0,0 +1,25 @@
1
+def encodeString(sentence):
2
+ sentence = sentence.split()
3
+ for i in range(len(sentence)):
4
+ sentence[i] = sentence[i].capitalize()
5
+ return "".join(sentence)
6
+
7
+def decodeString(sentence):
8
+ if not sentence:
9
+ return ""
10
+ decodedSentence = []
11
+ word = sentence[0]
12
+ for i in range(1,len(sentence)):
13
+ if sentence[i].isupper():
14
+ decodedSentence.append(word)
15
+ word = sentence[i].lower()
16
+ else:
17
+ word += sentence[i]
18
19
+ return " ".join(decodedSentence)
20
21
+sentence = input("Enter a String: ")
22
+encodedSentence = encodeString(sentence)
23
+decodedSentence = decodeString(encodedSentence)
24
+print("Converted String is {}".format(encodedSentence))
25
+print("Original String is {}".format(decodedSentence))
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments