Saturday, 16 January 2021

Anagram

 Question : check weather given string is anagram or not

please google out what is Anagram in case you don't know

Test 1:

str1 = dog

str2 = God

Ans = Its Anagram


Test 2 : 

str1 = digit

str2 = date

Ans = not Anagram


code:

def anagram(str_1, str_2):
#defining the anagram function
p = set(str(str_1.replace(" ", "").lower()))
q = set(str(str_2.replace(" ", "").lower()))
counter = 0
if p == q :
print("Its anagram")
else:
print("Its not anagram")


s = "digit"
t = "date"
anagram(s, t)

No comments:

Post a Comment

Author Details

Hi, I'm Prashant — a full-time software engineer with a passion for automation, DevOps, and sharing what I learn. I started Py-Bucket to document my journey through tools like Docker, Kubernetes, Azure DevOps, and PowerShell scripting — and to help others navigate the same path. When I’m not coding or writing, I’m experimenting with side projects, exploring productivity hacks, or learning how to build passive income streams online. This blog is my sandbox — and you're welcome to explore it with me. Get in touch or follow me for future updates!

About Me

About the Author

Author

Hi, I'm Prashant — a full-time software engineer with a passion for automation, DevOps, and sharing what I learn. I started Py-Bucket to document my journey through tools like Docker, Kubernetes, Azure DevOps, and PowerShell scripting — and to help others navigate the same path.

When I’m not coding or writing, I’m experimenting with side projects, exploring productivity hacks, or learning how to build passive income streams online. This blog is my sandbox — and you're welcome to explore it with me.

Get in touch or follow me for future updates!