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.
![sWAP cASE - Hackerrank Solution](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT-c2YJMTy15gzM_68mgjlWh8aRvW1TfvMU2hZ_RVoVJ2j3U3ve3GINiJGULOraG4GMzWbuYx720zKYrIPVk5TH8g6V9aVtjkxFEKjp3cj-DlDBF-bWIKZpjJS4sT7DPTmCINm1E02Ofc/s72-w200-c-h146/PicsArt_12-05-08.28.13%255B1%255D.jpg)
No comments: