Implement a program that requests three words strings from t

Implement a program that requests three words (strings) from the user. Your program should print Boolean value True if the words were entered in dictionary order; otherwise nothing is printed. >>> Enter first word: bass Enter second word: salmon Enter third word: whitefish True

Solution

Here\'s the python code to implement the task

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)

 Implement a program that requests three words (strings) from the user. Your program should print Boolean value True if the words were entered in dictionary ord

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site