Q. Write a function in python, which accept a list of names as argument and return total number of palindrome names. Use the same function to test.


Answer :-


def check(lst):
    count = 0
    for i in lst:
        for j in lst:
            if i == j [ ::-1]:
                count += 0.5
    return "Total number of palindrome :-", int(count)

lst = ["path","walla","htap","python","allaw"]
print( check(lst) )


Output :-

('Total number of palindrome :-', 2)
>>>

4 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. Hi Brother. Thanks for your help..... One small request... Can you provide SUMITA ARORA pdf of C++ and JAVA CLASS 11 AND 12. These are very demanding books right now especially and really would like to see your site traffic increase after you add this book. I would be grateful. Thanks.

    ReplyDelete
  2. Yes sir/maam... Even I need these books.. I would like to donate to you after you upload these books...

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post