File tree 1 file changed +7
-8
lines changed
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 1
- '''
1
+ """
2
2
This algorithm helps you to swap cases.
3
3
4
4
User will give input and then program will perform swap cases.
10
10
2)>>> Please input sentence: github.com/mayur200
11
11
GITHUB.COM/MAYUR200
12
12
13
- '''
13
+ """
14
14
import re
15
- '''
16
- This re.compile() function saves the pattern from 'a' to 'z' and 'A' to 'Z' into 'regexp' variable
17
- '''
18
- regexp = re .compile ('[^a-zA-Z]+' )
15
+
16
+ # This re.compile() function saves the pattern from 'a' to 'z' and 'A' to 'Z' into 'regexp' variable
17
+ regexp = re .compile ("[^a-zA-Z]+" )
19
18
20
19
21
20
def swap_case (sentence ):
@@ -24,7 +23,7 @@ def swap_case(sentence):
24
23
>>> swap_case('Algorithm.Python@89')
25
24
aLGORITHM.pYTHON@89
26
25
"""
27
- new_string = ''
26
+ new_string = ""
28
27
for char in sentence :
29
28
if char .isupper () == True :
30
29
new_string += char .lower ()
@@ -36,5 +35,5 @@ def swap_case(sentence):
36
35
return new_string
37
36
38
37
39
- if __name__ == ' __main__' :
38
+ if __name__ == " __main__" :
40
39
print (swap_case (input ("Please input sentence:" )))
You can’t perform that action at this time.
0 commit comments