Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions 2022-Oct/03 Oct 2022/dev_zohaib.py
Original file line number Diff line number Diff line change
@@ -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))