Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 711abae

Browse files
Merge pull request #23 from Sofiia2001/new_branch
Adding the solved problem 1
2 parents aec9199 + d995591 commit 711abae

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /