write a function named twowordsv2 that has the same specification as problem 1, but implement it using while and not using break. (hint: provide a dif

Answers

Answer 1

write a function named twowordsv2 that has the same specification as problem 1, but implement it using while and not using break.

Code in Python:

def twoWordsV2 (lgt,firstLr)

{

  w1 = ""

  w2= ""  

  while(len(w1)!=length)

  {

      word1 = input('A ' + str(lgt) + '-letter word here: ')

      }

  while(word2!=firstL):

    {

      word2 = input(' Word that begins with ' + firstL')

      if word2[0] == firstL.upper() or word2[0] == firstL.lower():

     {

          return [w1,w2]                

        }

print(twoWordsV2(4,'B'))

    }

}

What is a while loop? How does it work?

A while loop is a control flow statement that enables code to be performed repeatedly in most computer programming languages based on a specified Boolean condition. You can think of the while loop as an iterative if statement.

The while loop runs the code after first determining if the condition is true. Until the given condition returns false, the loop doesn't end. As an alternative, the do while loop only executes its code a second time if the condition is satisfied after the first execution.

To learn more about while loop, use the link given
https://brainly.com/question/19344465
#SPJ4


Related Questions

which cloud computing service model describes cloud-based systems that are delivered as a virtual solution for computing that allows firms to contract for utility computing as needed rather than build data centers?

Answers

Infrastructure as a Service is the concept that is cloud-based systems that is supplied as virtualized solution for computing that permits businesses to pay for utility computing instead of building data centers.

Describe data.

Data are a group of discrete values that describe amount, quality, fact, statistics, or other fundamental units of meaning, or they can simply be a series of symbols that can be further understood. A data is a specific value included in a group of data. The majority of the time, data is arranged into smaller structures, such tables, which give more context and meaning and can also be used as information in larger structures. It's possible to use data as variables in a calculation. Data can represent intangible concepts.

To know more about data
https://brainly.com/question/26711803
#SPJ1

Other Questions
Is nonverbal communication intrapersonal?. a random sample of 784 10-ounce cans of fruit nectar is drawn from among all cans produced in a run. prior experience has shown that the distribution of the contents has a mean of 10 ounces and a standard deviation of .10 ounce. what is the probability that the mean contents of the 784 sample cans is less than 9.995 ounces? a) 0.131 b) 0.081 c) 0.101 d) 0.111 e) 0.121 f) none of the above how is the period of time during which the marble is being flicked completely different from the rest of the trip? Q12) 150 Chinese Yuan is about $21 US dollars. How much (in US dollars) will an item cost in 700 Chinese Yuan? osteoporosis is a disease that results in weakened, porous bones. it is most common in post-menopausal women. what type of change in bone cell activity could cause osteoporosis? Which characteristics of satire are evident in a modest proposal?. Use the drop-down menus to answer the questions about the passage. Which key words in the passage help you identify the tone? what connotation do these key words have?. Which symbol correctly compares these two fractions?3/10 ? 1/3 A. =B. >C. when a company has a customer that has not paid its account receivable and negotiates that the customer will provide an interest-bearing note in satisfaction of the account receivable, it will? While the Duke and Dauphin seem to be two bumbling !d!ots, their cruelty can be seen in the fact that they continually...a) run off with all the money at the revival meeting.b) attend revival meetings.c) are thr3at3ning Jim's status.d) are trying to murd3r the drvnk man. all cells are enclosed by a plasma membrane that is similar in and . question 14 options: thickness . . . composition permeability . . . content lucidity . . . texture structure . . . function Click through the list of sources to find the one which would NOT be a good source for the topic below.Your home townSource:almanacatlasperiodicalsconcordancebooks What are 3 signs of symptoms of an allergic reaction?. when a plant asset is retired, the difference between original cost and the book value of the asset is A 0.9295 g Sample of Cobalt Chloride Hydrate is heated until it reaches a constant mass of 0.5976 g. Assume that only water is removed. Calculate the Percent of water. R is inversley propeotional to A When R=12, A=1.5 Select the correct answer.Read paragraph 6 in the passage. Which detail best explains the reason why Zitkla- is "both frightened and insulted" by being tossed into the air? A. "I stared into her eyes, wishing her to let me stand on my own feet...." B. "My mother had never made a plaything of her wee daughter." C. "Remembering this I began to cry aloud." D. "Entering the house, I stood close against the wall." 2.9 - 4.8n - 3n + 5 simplified which questions should the nurse ask when assessing for risk factors for metabolic acidosis? (select all that apply.) the problem associated with the government reacting to the record harvests by increasing taxes or decreasing spending is: