Skip to content

Commit 2c06916

Browse files
authored
Merge pull request #1 from creativehackerhacks/patch-1
Using function
2 parents 6cf4b9a + 2caf30f commit 2c06916

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

Strings/sWAPcASE.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
Created : 15 July 2016
77
'''
88
__author__ = 'arsho'
9-
inputString=input()
10-
finalString=""
11-
for i in range(0,len(inputString)):
12-
currentChar=inputString[i]
13-
if(currentChar.islower() or currentChar.isupper()):
14-
finalString+=currentChar.swapcase()
15-
else:
16-
finalString+=currentChar
17-
print(finalString)
9+
def swap_case(s):
10+
newstring = ""
11+
12+
for item in s:
13+
if item.isupper():
14+
newstring += item.lower()
15+
else:
16+
newstring += item.upper()
17+
18+
return newstring

0 commit comments

Comments
 (0)