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 aec9199 + d995591 commit 711abaeCopy full SHA for 711abae
Challenge questions/Sofiia2001/problem_1.py
@@ -0,0 +1,33 @@
1
+def formatting(sentence):
2
+ sentence = list(sentence)
3
+ for symbol in range(len(sentence) - 1):
4
+ if sentence[symbol] == ' ':
5
+ sentence[symbol] = ''
6
+ sentence[symbol + 1] = sentence[symbol + 1].upper()
7
+
8
+ sentence = ''.join(sentence)
9
+ return sentence
10
11
12
+def formatting_back(sentence):
13
+ to_return = [sentence[0]]
14
+ for symbol in sentence[1:]:
15
+ if symbol == symbol.upper():
16
+ to_return.append(' ')
17
+ to_return.append(symbol.lower())
18
+ else:
19
+ to_return.append(symbol)
20
+ to_return = ''.join(to_return)
21
+ return to_return
22
23
24
+def main():
25
+ sentence = str(input('Enter yor string: '))
26
+ formatted = formatting(sentence)
27
+ print(f'Formatted: {formatted}')
28
+ formatted_back = formatting_back(formatted)
29
+ print(f'Formatted back: {formatted_back}')
30
31
32
+if __name__ == '__main__':
33
+ main()
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments