14. Swap Cases: Hackerrank | Python Solution Explained
ฝัง
- เผยแพร่เมื่อ 5 ก.ย. 2024
- In this tutorial, I am showing you how to easily and efficiently tackle this hackerrank challenge. The video will also teach you the fundamentals and necessary operations to achieve that.
#hackerrank #hackerranksolutions #pyhtonhackerrank #nestedlists
I have one question, if we are using swapcase() method that can directly convert uppercase to lower and vice versa then what's the point to use for loop here??
can we use like this??
def swap_case(s):
return
if __name__ == '__main__':
s = input("Enter the String: ")
result = s.swapcase()
print("
String after swap:", result)
print("
String after reverse:", result[::-1])
Hi there, I have been following your Hacherrank exercise videos and have started to be able to solve them on my own. Your explanations have helped me a lot, now I know how to tackle the challenges. thanks!
Btw, I find the structure of commands in Python very confusing, sometimes they are written as "sum(value)" or "my_list.sort()". The variable that is making the change can be inside the parenthesis and others before the command and with empty parenthesis. Is there any reason for it to be like it?
Thanks for your message and I am glad I can help😃 you have a great question there and I have been trying to make as many videos to explain.
But in short, different data structures have different types of functions and methods that can be used. For example some of them like "sum" can be used on a list. I hope this helps😃
i have a issue in parameter you set parameter in swap function s but used new_s
which is not in parameter sir plz explain that