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
erastova [34]
3 years ago
6

Define and implement a method that takes a string array as a parameter and returns the length of the shortest and the longest st

rings in the array
Computers and Technology
1 answer:
Drupady [299]3 years ago
7 0

Answer:

#HERE IS CODE IN PYTHON

#function to find length of shortest and longest string in the array

def fun(list2):

   #find length of shortest string

   mn=len(min(list2))

   #find length of longest string

   mx=len(max(list2))

   #return both the value

   return mn,mx

#array of strings

list2 = ['Ford', 'Volvo', 'BMW', 'MARUTI','TATA']

# call the function

mn,mx=fun(list2)

#print the result

print("shortest length is:",mn)

print("longest length is:",mx)

Explanation:

Create an array of strings.Call the function fun() with array as parameter. Here min() function will find the minimum string among all the strings of array and then len() function will find its length and assign to "mn". Similarly max() will find the largest string and then len() will find its length and assign to "mx". Function fun() will return "mn" & "mx".Then print the length of shortest and longest string.

Output:

shortest length is: 3

longest length is: 5

You might be interested in
suppose task c has two predecessor tasks: task a and task b. task a ends on may 8 and task b ends on may 13. when can task c beg
san4es73 [151]

Suppose task c has two predecessor tasks: task a and task b. task a ends on may 8 and task b ends on may 13. The time that task c can  begin is may 14.

<h3>What does task mean in its other sense?</h3>

It is seen as Assignment, chore, duty, job, and stint are a few examples of common synonyms for task. Task implies work that is imposed by a person in authority, an employer, or circumstances, even though all of these words mean "a piece of work to be done."

Note that you may be asked to write a letter, a feature article, an editorial, or a speech. who you're pretending to write to in response to the prompt. Hence starting by on the 14th is advisable.

Learn more about task  from

brainly.com/question/12831236
#SPJ1

8 0
1 year ago
When encoding information, which of the five senses has been shown to be more durable and last longer in memory?
Llana [10]
<span>Olfactory memory tends to be the most durable. Surprisingly, smells tend to be the most strongly related with memories. This has been shown by people being able to associate smells with events for longer periods than any other sensory input. Most other inputs only stay in memory for a period of milliseconds, up to 2-4 seconds at the most.</span>
8 0
3 years ago
Random question: on a scale of 1-10 how much do you all hate Edgenuity?
Alika [10]

-100 it is horruble, I would never join the class

7 0
3 years ago
Read 2 more answers
How many different messages can be transmitted in n microseconds using three different signals if one signal requires 1 microsec
SIZIF [17.4K]

Answer:

a_{n} = 2/3 . 2^n + 1/3 . (-1)^n

Explanation:

Let a_{n} represents number of the message that can transmitted in <em>n </em>microsecond using three of different signals.

One signal requires one microsecond for transmittal: a_{n}-1

Another signal requires two microseconds for transmittal: a_{n}-2

The last signal requires two microseconds for transmittal: a_{n}-2

a_{n}= a_{n-1} + a_{n-2} + a_{n-2} = a_{n-1} + 2a_{n-2}, n ≥  2

In 0 microseconds. exactly 1 message can be sent: the empty message.

a_{0}= 1

In 1 microsecond. exactly 1 message can be sent (using the one signal of one  microseconds:

a_{0}= 1

2- Roots Characteristic equation

Let a_{n} = r^2, a_{n-1}=r and a_{n-2}= 1

r^2 = r+2

r^2 - r - 2 =0                 Subtract r+6 from each side

(r - 2)(n+1)=0                  Factorize

r - 2 = 0 or r +1 = 0       Zero product property

r = 2 or r = -1                 Solve each equation

Solution recurrence relation

The solution of the recurrence relation is then of the form a_{1} = a_{1 r^n 1} + a_{2 r^n 2} with r_{1} and r_{2} the roots of the characteristic equation.

a_{n} =a_{1} . 2^n + a_{2}.(-1)"

Initial conditions :

1 = a_{0} = a_{1} + a_{2}

1 = a_{1} = 2a_{1} - a_{2}

Add the previous two equations

2 = 3a_{1}

2/3 = a_{1}

Determine a_{2} from 1 = a_{1} + a_{2} and a_{1} = 2/3

a_{2} = 1 - a_{1} = 1 - 2 / 3 = 1/3

Thus, the solution of recursion relation is a_{n} = 2/3 . 2^n + 1/3 . (-1)^n

6 0
3 years ago
Can you explain why you got the error message when trying to use the command x = c\d
ASHA 777 [7]
Do You mean x= x / d   ?....because there is no " \ " in math operations
6 0
3 years ago
Other questions:
  • What wired channel, commonly used for cable tv, consists of an insulated copper wire wrapped in a solid or braided shield placed
    12·1 answer
  • A restaurant bill comes to $28.35. Find the total cost if the tax is 6.25% and a 20% tip is left on the amount before tax.​
    6·1 answer
  • People use a computer connected to the internet to manage financial accounts
    15·1 answer
  • Who can help me please? ​
    14·1 answer
  • Why does dew form on grass overnight
    7·1 answer
  • What is an "immediate preemptive scheduler"?
    15·1 answer
  • Help me asap please
    15·1 answer
  • To view the Picture tools tab, a user must first _____.
    10·2 answers
  • What code would you use to create the login button?
    11·1 answer
  • Explain the difference between overexposed vs. underexposed images?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!