我正在尝试创建一个程序,询问用户三个单词并在单词按字典顺序输入的情况下打印“True”。例如:
Enter first word: chicken
Enter second word: fish
Enter third word: zebra
True
到目前为止,这是我的代码:
first = (input('Enter first word: '))
second = (input('Enter second word: '))
third = (input('Enter third word: '))
s = ['a','b','c','d','e','f','g','h',
'i','j','k','l','m','n','o','p',
'q','r','s','t','u','v','w','x',
'y','z','A','B','C','D','E','F',
'G','H','I','J','K','L','M','N',
'O','P','Q','R','S','T','U','V',
'W','Z','Y','Z']
if s.find(first[0]) > s.find(second[0]) and s.find(second[0]) > s.find(third[0]):
print(True)