answer.
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
2 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]2 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
Gwen recently purchased a new video card, and after she installed it, she realized she did not have the correct connections and
g100num [7]

Answer:

A. 8-pin PCI-E connector.

F. 6-pin PCI-E connector.

Explanation:

The video card is a peripheral hardware component in a computer system that is used to run videos and graphic files, providing the required memory, runtime and bandwidth.

The PCI-e or peripheral component interconnect express is a connector or expansion slot used specifically for adding and powering video cards on a computer system.

7 0
2 years ago
PLEASE HELP PROGRAMMING WILL GIVE BRAINLIEST
JulijaS [17]
The fourth choice is correct.
5 0
2 years ago
__________ is the current federal information processing the standard that specifies a cryptographic algorithm used within the U
Free_Kalibri [48]

Answer:

FIPS 140-2 es el acrónimo de Federal Information Processing Standard (estándares federales de procesamiento de la información), publicación 140-2, es un estándar de seguridad de ordenadores del gobierno de los Estados Unidos para la acreditación de módulos criptográficos. ... El Instituto Nacional de Estándares y Tecnología (NIST)

Explanation:

8 0
2 years ago
Meadowdale Dairy Farm sells organic brown eggs to local customers. It charges $3.25 for a dozen eggs, or 45 cents for individual
svp [43]

Answer:

Explanation:

import java.Util;

public class Eggs{

public static void main (String [] args)

{

int noOfEggs, dozen, units;

float total;

Scanner input = new Scanner(System.in);

noOfEggs = input.nextInt();

if(noOfEggs < 0)

{

System.out.print("Invalid");

}

else

{

if(noOfEggs >= 12)

{

dozen = noOfEggs/12;

units = noOfEggs % 12;

}

else

{

dozen = 0;

units = noOfEggs;

}

total = dozen * 3.25 + (units * 45)/100;

System.out.print("You ordered "+noOfEggs+" eggs.\n");

System.out.print("That's "+dozen+" dozen at $3.25 per dozen and "+units+" loose eggs at 45 cents each for a total of $"+total);

}

}

}

7 0
2 years ago
Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two
qaws [65]

Answer:

Se explaination

Explanation:

/Declaring variables

integer currentPrice

integer lastMonthPrice

integer changeLastMonth

float mortagage

//Reading input

currentPrice = Get next input

lastMonthPrice = Get next input

//Calculating price change

changeLastMonth = currentPrice - lastMonthPrice

//Calculating mortagage

mortagage = (currentPrice * 0.051) / 12

//Printing output

Put "This house is $" to output

Put currentPrice to output

Put "\nThe change is $" to output

Put changeLastMonth to output

Put " since last month." to output

Put "\nThe estimated monthly mortgage is $" to output

Put mortagage to output

3 0
2 years ago
Other questions:
  • In a situation where handicapped person can only input data into the computer using a stylus or light pen, which keyboard config
    7·2 answers
  • Robin wants her presentation to move from one slide to another with special motion effects. Which option should Robin use?
    15·2 answers
  • Which type of broadband internet access involves using cellular data networks? ​?
    13·1 answer
  • Ben's team is working on an English project. The members want to see everyone's progress on their part of the project. What tech
    7·2 answers
  • Create a program to deteate a program to determine whether a user-specified altitude [meters] is in the troposphere, lower strat
    11·1 answer
  • Use the following data definitions data myBytes BYTE 10h,20h,30h,40h myWords WORD 3 DUP(?),2000h myString BYTE "ABCDE" What will
    9·1 answer
  • LensForAll is a company that sells affordable contact lenses on its website. The CEO of the company realizes that an app must be
    9·1 answer
  • Describe the indicators and hazards of a metal deck roof fire in an unprotected steel joist warehouse as well as the techniques
    6·1 answer
  • Write a program that reads the lengths of the sides of a triangle from the user. Compute the area of the triangle using Heron's
    8·1 answer
  • 4.2 Code Practice: Question 2
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!