Assignment 17 — conditional analysis
Due Saturday, October 8
Program pigeonhole.py
- Produce a program that prompts the user for a single string and reports on its form. There should be no other output.
- If the input is empty, the program displays exactly string
"empty"
and nothing else. A string is empty, if it has length 0.
- If instead, the input is a single character, the program displays exactly string
"character"
and nothing else. A string is a single character, if it has length 1.
- Otherwise, the program displays exactly string
"characters"
and nothing else.
- Some possible program runs
Enter string: Icharacter
Enter string: Youcharacters
Enter string: Everyone in the worldcharacters
Enter string: <--- no text provided, not even a spaceempty
- This problem seems like an excellent opportunity to use the Python
if-elif-else
construct.