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
4 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]4 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
For which of the four game elements will you give a detailed description about the challenges that the player will face, such as
vaieri [72.5K]

The four game elements that will give you  a detailed description about the challenges that the player will face is option D: objective.

<h3>What goals does game development have?</h3>

To bring about creativity and originality in task completion and issue solving. to prepare pupils for group collaboration.

Note that giving the player a clear objective gives them something to aim for. Make sure the player can relate to this motivation.

Therefore, The most crucial component of a game can be its objectives, which determine how the game is won or lost, what the player is instructed to perform in-game, and what the player must do to gain optional <em>Achievements</em>.

Learn more about objective from

brainly.com/question/18516671
#SPJ1

3 0
1 year ago
Which of the following initializer lists would correctly set the elements of array n?
Elina [12.6K]

Answer:

The correct answer to this question is option (a).

Explanation:

In the programming language (java) the syntax for declaring,initializing single denominational array can be given as:

Syntax:

datatype array[] arrayname;            // declare the array

Example:             int [] a;                    

a = new int[5];              // create the array

int [] n ={2,5,7,9,3};                 // initialize all elements

Or

a[0] = 2;

a[1] = 22;

a[2] = 12;

a[3] = 20;

a[4] = 23;

In the above we define the way to initialize the array. So the correct way to set array element is option (a).

3 0
3 years ago
[Edhesive] 4.1 Code Practice
Mashcka [7]

Answer:

(In Python 3.8.6)

import sys

while 7 > 6:

   input = str(sys.stdin.readline())

    if input == "Nope":

           break

    else:

           print(f"Nice to meet you, {input}.")

4 0
3 years ago
Read 2 more answers
Hey I just got home I got a call back on and my car was in my bed I got a text and I didn’t get my text back from the house I wa
Phantasy [73]
Y’all what are you tryna say
6 0
4 years ago
g You need to build a circuit to perform parallel data transfers from one set of registers to another. The interconnections betw
Phoenix [80]

Answer:

JK Flip Flop

Explanation:

Flip Flops is a fundamental building blocks of digital electronics systems.  It  is an electronic circuit with two stable states that can be used to store binary data.  However, a JK Flip Flop is a type of universal flip-flop that makes the circuit toggle between two states and is widely used in shift registers.

So when building a circuit to perform parallel data transfers from one set of registers to another, a JK Flip Flop is the best choice he register FFs when you need to hold the interconnection between the register to a minimum.

6 0
4 years ago
Read 2 more answers
Other questions:
  • Max magnitude Write a method maxMagnitude() with two integer input parameters that returns the largest magnitude value. Use the
    13·1 answer
  • If you are asked to bring in agile way of working into the way a meeting runs, which one among the listed options will you imple
    11·1 answer
  • A step commonly used for Internet vulnerability assessment includes __________, which occurs when the penetration test engine is
    9·1 answer
  • In 2–3 sentences, describe how you would find a certain record.
    11·2 answers
  • Alcohol does not affect the driver judgement
    8·2 answers
  • If an Administrator performs a clean install of Windows Server 2012 R2 on a new server, and then moves critical domain services
    9·1 answer
  • To type a small letter "z", you would use the right little finger. (5 points)True False
    9·1 answer
  • An object contains data and the instructions that manipulate the data (Points : 2) True
    8·1 answer
  • What happens if the user sysadmin invokes the mail command interface and there are no unread mail messages?
    13·1 answer
  • Que compone una maquina Rube Goldberg (operadores mecánicos- maquinas simples – mecanismos)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!