title: script to swap case in python
body: <p>this script is supposed to swap case in words but the result is really weird and doesn't make sense</p>
  
  <pre><code>def swap_case(s):
  for i in range(len(s)):
      if s[i].islower():
          s= s.replace(s[i],s[i].upper())
      elif s[i].isupper():
          s= s.replace(s[i],s[i].lower())
      else:
          pass
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/D7CAF.png" rel="nofollow noreferrer">example</a></p>