Get the App
SLTechnology News&Howtos  ›  Development  › 

How to check the crossword puzzle of two strings by python

Shulou Source: shulou.com Published: 2022-06-01 05:25:20 10月01日 Update

This article is about how python checks the crossword puzzle of two strings. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Check the crossword puzzle of two strings

If a string consists of characters in another string, the two strings are puzzles. We can use the same Counter method in the collections module.

From collections import Counter my_string_1 = "RACECAR" my_string_2 = "CARRACE" if (Counter (my_string_1) = = Counter (my_string_2)): print ("Anagram") else: print ("Not Anagram")

Output quantity

Anagram, thank you for your reading! This is the end of this article on "how to check the crossword puzzle of two strings in python". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Character string two crossword puzzle check content more article good practical same article method module see knowledge reference help related output Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Docker Xiaomi Microsoft macOS