Dcoder icon

Toggle Me! @ Dcoder

By Lochard | As a newbie programmer | 6 Jul 2023


Problem: Cody is very irritating child. He always change the characters in his homework, he has a trick. He change all small letter to capital and viceversa. His frinds gave him the title "The Toggle dude".One day his friends gave him some words, but he wasn't feeling well, so you have to help him converting the given Strings to Special String.

The String after applying Cody's trick is called Special String.

Input: Input is a String S

Output: Print the Special String of the given String.

Constraints: 1<=S length<=15

Sample Input: Dcoder123

Sample Output: 

dCODER123

s = input()
for c in s:
  if c.islower():
    print(c.upper(), end='')
  else:
    print(c.lower(), end='')

How do you rate this article?

4


Lochard
Lochard

20240228 Arrived in the UK for about 2 week. All my fears persist. Some are even getting worse. https://github.com/locharp/asylum_diary/


As a newbie programmer
As a newbie programmer

Sharing entry level codes. My snippets on GitHub https://github.com/locharp/code-snippets

Publish0x

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.