From 7578e0b920831c0ee3274cbfdaa6dc2b6a82cc97 Mon Sep 17 00:00:00 2001 From: Rohanrbharadwaj <89947037+Rohanrbharadwaj@users.noreply.github.com> Date: Sun, 10 Oct 2021 23:22:38 +0530 Subject: [PATCH] Used in-built method (#5183) * Used in-built method * Delete swap_case.py Co-authored-by: Christian Clauss --- strings/swap_case.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 strings/swap_case.py diff --git a/strings/swap_case.py b/strings/swap_case.py deleted file mode 100644 index 107fda4b5..000000000 --- a/strings/swap_case.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -This algorithm helps you to swap cases. - -User will give input and then program will perform swap cases. - -In other words, convert all lowercase letters to uppercase letters and vice versa. -For example: -1. Please input sentence: Algorithm.Python@89 - aLGORITHM.pYTHON@89 -2. Please input sentence: github.com/mayur200 - GITHUB.COM/MAYUR200 - -""" - - -def swap_case(sentence: str) -> str: - """ - This function will convert all lowercase letters to uppercase letters - and vice versa. - - >>> swap_case('Algorithm.Python@89') - 'aLGORITHM.pYTHON@89' - """ - new_string = "" - for char in sentence: - if char.isupper(): - new_string += char.lower() - elif char.islower(): - new_string += char.upper() - else: - new_string += char - - return new_string - - -if __name__ == "__main__": - print(swap_case(input("Please input sentence: ")))