-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathc1.py
More file actions
41 lines (32 loc) · 830 Bytes
/
c1.py
File metadata and controls
41 lines (32 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
def print_without_spaces(some_str):
flag = 0
other_str=""
for i in some_str:
if flag == 0 and i!=" ":
other_str+=i
elif i==" ":
flag=1
elif flag==1 and i!=" ":
flag=0
i=i.upper()
other_str+=i
return other_str
def print_with_spaces(some_str):
flag=0
other_str=""
for i in some_str:
if i>="A" and i<="Z":
flag=1
if flag==0 and i!=" ":
other_str+=i
if flag == 1:
i=i.lower()
flag=0
other_str+=" "
other_str+=i
other_str = other_str[1].capitalize()+other_str[2:]
return other_str
some_str=input("Enter the string : ")
some_str=print_without_spaces(some_str)
print(some_str)
print(print_with_spaces(some_str))