Task:
You are given a string and your task is to swap cases. In other words, convert all lowercase letters to uppercase letters and vice versa.
For Example:
Www.HackerRank.com → wWW.hACKERrANK.COM
Pythonist 2 → pYTHONIST 2
Solution:
def change(s): if str.islower(s): return str.upper(s) else: return str.lower(s) def swap_case(s): return ('').join(map(change,s)) if __name__ == '__main__': s = input() result = swap_case(s) print(result) |
Note:
This Code is Verified by all Test Cases.If any error occurs then Comment correct code Below in comment box.
Disclaimer:-
The above hole problem statement is given by hackerrank.com, but the solution is generated by the CodexRitik . if any of the query regarding this post or website fill the following contact form Thank You.
No comments: