gpt4 book ai didi

python - 字谜Python 3

转载 作者:行者123 更新时间:2023-11-28 21:22:04 26 4
gpt4 key购买 nike

<分区>

我如何编写一个函数来检查 2 个输入是否是变位词?

word1 = input("Enter a string: ")
word2 = input("Enter a second string: ")

def isAnagram(s1, s2):
s1 = word1.sort()
s2 = word2.sort()
if s1 == s2:
print("This is an anagram")
else:
print("This is not an anagram)
isAnagram()

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com