1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
muminat
3 years ago
15

Create the strAnalysis() function that takes 1 string argument and returns a string message. The message will be an analysis of

a test string that is passed as an argument to strAnalysis(). The function should respond with messages such as:
"big number"
"small number"
"all alphabetic"
"multiple character types"
The program will call str_analysis() with a string argument from input collected within a while loop. The while loop will test if the input is empty (an empty string "") and continue to loop and gather input until the user submits at least 1 character (input cannot be empty).
The program then calls the str_analysis() function and prints the return message.
Sample input and output:

enter nothing (twice) then enter a word
enter word or integer:
enter word or integer:
enter word or integer: Hello
"Hello" is all alphabetical characters!

alphabetical word input:
enter word or integer: carbonization
"carbonization" is all alphabetical characters!

numeric inputs:
enter word or integer: 30
30 is a smaller number than expected

enter word or integer: 1024
1024 is a pretty big number
loop until non-empty input is submitted

Once the user gives input with characters use the input in calling the str_analysis() function.

Additional Details:
In the body of the str_analysis() function:

Check if string is digits
if digits: convert to int and check if greater than 99
if greater than 99 print a message about a "big number"
if not greater than 99 print message about "small number"
check if string isalpha then (since not digits)
if isalpha print message about being all alpha
if not isalpha print a message about being neither all alpha nor all digit
call the function with a string from user input

Run and test your code before submitting
# [ ] create, call and test the str_analysis() function
Computers and Technology
1 answer:
nydimaria [60]3 years ago
7 0

Answer:

def str_analysis(s):

   if s.isdigit():

       s = int(s)

       if s > 99:

           message = str(s) + " is a pretty big number"

       else:

           message = str(s) + " is a smaller number than expected"

       

   elif s.isalpha():

       message = s + " is all alphabetical characters!"

   else:

           message = "There are multiple character types"

   

   return message;

   

s = input("enter word or integer: ")

while s != "":

   print(str_analysis(s))

   s = input("enter word or integer: ")

Explanation:

- Check if the string is digit, alphabetical, or mixed inside the function

- Ask the user for the input

- Call and print the result of the <em>str_analysis</em> function inside the while loop

- Keep asking for the input until the given string is empty

You might be interested in
What is the main reason that IT managers believe the future IT career model will be diamond-shaped, with few entry-level IT jobs
Valentin [98]
<span>In which career field, would the Computing Technology Industry Association's CompTIA A+ certification be useful?</span>
4 0
3 years ago
Creating a newsletter
pav-90 [236]
This isn’t helpful considering no one knows what type of news letter you want
6 0
3 years ago
If you would like to compare information on two different Web pages, you should _____.
Gekata [30.6K]

Answer:

Use Tabs

Explanation:

I had this lesson on odyessy ware and this was right the other guy is wrong

4 0
2 years ago
Read 2 more answers
python Which data type is the best choice to store the number of wins associated with each basketball team in the NBA
Sveta_85 [38]

Answer:

integer

Explanation:

this data type must be  a number, but it will always be  a whole number, so boolean is not appropriate. This means that it will be integer data type

4 0
3 years ago
Read 2 more answers
Identify the variables listed below as either quantitative (discrete or continuous) or categorical (nominal or ordinal):
Akimi4 [234]

Answer:

Quantitative: Age, heart rate, number of pets, salary

 <em>discrete</em>: number of pets

 <em>continuous</em>: Age, heart rate, salary

Categorical: Gender, eye color, metal rankings

<em>Nominal:</em> Gender, eye color

<em>Ordinal:</em> metal rankings

Explanation:

Quantitative are those variables which are for quantity or number with units for measurement.

Categorical are qualitative variable which can be categorized or grouped in different groups or it may be ranking scales

5 0
3 years ago
Other questions:
  • When looking to ensure your website is easily accessible by mobile users, what should you focus on doing first
    8·1 answer
  • The grade of a metric bolt is designated by
    8·1 answer
  • Hy i am new anybody here​
    10·2 answers
  • Data as a service began with the notion that data quality could happen in a centralized place, cleansing and enriching data and
    15·1 answer
  • Often used in connection with a business
    6·1 answer
  • HELP PLZ !!
    13·1 answer
  • A thermostat with the processor program to control temperature is an example of what kind of computer
    6·1 answer
  • You are looking at computer ads. One has a processor that is 3.64GHz. What does this mean?
    5·1 answer
  • Help please match them if you just put a link or say “I don’t know but thanks for the points” I’ll report your answer and you wo
    10·1 answer
  • What is the difference between a loop and a function?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!