From 227618bd13ef49b74f657af7618dd6d9dc152e31 Mon Sep 17 00:00:00 2001 From: zohaib Date: Sat, 29 Oct 2022 00:26:02 +0500 Subject: [PATCH] Convert_case in Input string Created by devzohaib --- 2022-Oct/03 Oct 2022/dev_zohaib.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 2022-Oct/03 Oct 2022/dev_zohaib.py diff --git a/2022-Oct/03 Oct 2022/dev_zohaib.py b/2022-Oct/03 Oct 2022/dev_zohaib.py new file mode 100644 index 00000000..681d25e3 --- /dev/null +++ b/2022-Oct/03 Oct 2022/dev_zohaib.py @@ -0,0 +1,26 @@ +def convert_case(input_str: str) -> str: + """ + Problem: Accept a String from user & convert uppercase letter into + lowercase letter and vice versa + + input : "Hello World" + output: "hELLO wORLD" + + :param input_str: + :return: str + """ + new_str = '' + for i in input_str: + if i.isupper(): + new_str += i.lower() + elif i.islower(): + new_str += i.upper() + else: + new_str += i + return new_str + + +# Driver Code +if __name__ == '__main__': + input_str = input("Input: ") + print("Output: ", convert_case(input_str))