我创建了这个程序,如果它是对称的,它应该显示一个单词的镜像。不幸的是,当我测试“TIMOTHY”时,它显示它无法被镜像,我无法弄清楚为什么这不起作用。
#Program for creating a mirrored
#image word#
def main():
mirrors = ["A","H","I","M","O","T","U","V","W","X","Y"
"b","d","i","l","m","o","p","t","v","w","x"]
word = input("Enter in the word you'd like mirrored: ")
for x in word:
if x not in mirrors:
y = True
break
if y == True:
print("Sorry your word can not be mirrored")
wordlist = ''.join(word[i] for i in range(len(word) -1, -1, -1 ))
print(wordlist)
main()