A Way For Learning

Program to toggle between lowercase and uppercase characters in a string

No comments
input=raw_input('')
res=""
for x in xrange(len(input)):
val=ord(input[x])
if(val>=65 and val<=90 ):
res+=chr(val+32)
elif(val>=97 and val<=122):
res+=chr(val-32)
else:
res+=input[x]
print res

No comments :

Post a Comment