Write a Python program that prompts the user for a word. If the word comes between the words appleand pear alphabetically, print a message that tells the user that the word is valid, otherwise, tell the user the word is out of range.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 20PE
icon
Related questions
Question

Write a Python program that prompts the user for a word. If the word comes between the words appleand pear alphabetically, print a message that tells the user that the word is valid, otherwise, tell the user the word is out of range.

Input Format

Input will be one lowercase word with no spaces.
Prompt must say "Enter a word "

Constraints

Do not use any functions for the comparison, only operators.

Output Format

"valid" or "out of range"

Sample Input 0

bananas

Sample Output 0

Enter a word valid

Sample Input 1

voavanga

Sample Output 1

Enter a word out of range
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,