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 b7e9dc4

Browse files
Challange-1
1 parent 711abae commit b7e9dc4

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

‎Hemant-60/c1.py‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
def print_without_spaces(some_str):
2+
flag = 0
3+
other_str=""
4+
for i in some_str:
5+
if flag == 0 and i!=" ":
6+
other_str+=i
7+
elif i==" ":
8+
flag=1
9+
elif flag==1 and i!=" ":
10+
flag=0
11+
i=i.upper()
12+
other_str+=i
13+
14+
return other_str
15+
def print_with_spaces(some_str):
16+
flag=0
17+
other_str=""
18+
for i in some_str:
19+
if i>="A" and i<="Z":
20+
flag=1
21+
22+
if flag==0 and i!=" ":
23+
other_str+=i
24+
25+
26+
if flag == 1:
27+
i=i.lower()
28+
flag=0
29+
other_str+=" "
30+
other_str+=i
31+
32+
other_str = other_str[1].capitalize()+other_str[2:]
33+
34+
return other_str
35+
36+
37+
some_str=input("Enter the string : ")
38+
some_str=print_without_spaces(some_str)
39+
print(some_str)
40+
print(print_with_spaces(some_str))
41+

0 commit comments

Comments
(0)

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