Question: In python, high school assignment, please keep simple 7.2 Code Practice: Question 1 Instructions Write a program that asks the user to input a word
In python, high school assignment, please keep simple
7.2 Code Practice: Question 1
Instructions
Write a program that asks the user to input a word or phrase and then outputs the following information about that phrase:
- All numbers if the input is all numbers.
- Does not contain numbers if the input does not contain any numbers.
- Contains a {digit} for each number in the phrase.
Sample Run
Enter your word or phrase: 555
All numbers
Enter your word or phrase: We are #1!
Contains a 1
Enter your word or phrase: a1b2c3d
Contains a 1
Contains a 2
Contains a 3
Enter your word or phrase: computer science
Does not contain numbers
Hints
- You may wish to use a loop that goes from the digits 0 to 9, and remember that loops can be used for processing string values when appropriate.
- In order to at the end see if any numbers have been found, you can create a true-false variable that is initialized before your for loop, and use an if-else statement inside of that loop that modifies the variable if any numbers have been found. Variables used in this fashion are called flag variables.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
