subject

Problem 1: Write a function named twoWords that gets and returns two words from a user. The first word is of a specified length, and the second word begins with a specified letter. The function twoWords takes two parameters:

i. an integer, length, that is the length of the first word and
ii. a character, firstLetter, that is the first letter of the second word. The second word may begin with either an upper or lower case instance of firstLetter. The function twoWords should return the two words in a list. Use a while True loop and a break statement in the implementation of twoWords.

The following is an example of the execution of twoWords:

print(twoWords(4, 'B')) A 4-letter word please :two
A 4-letter word please: one
A 4-letter word please : four
A word beginning with B please : apple
A word beginning with B please: pear
A word beginning with B please: banana
['four', 'banana']

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 different boolean condition for while.) Since only the implementation has changed, and not the specification, for a given input the output should be identical to the output in Problem 1.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:00
Your computer running windows 10 is doing some very strange things with the operating system. you are fairly certain it is not a hardware issue. you need to try to get further insight into what is going on within the operating system. which tool would be best suited for this?
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Selling a product through an electronic medium is
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
On early television stations, what typically filled the screen from around 11pm until 6am? test dummies test patterns tests testing colors
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
Helen's credit card has an apr of 15.32% and a grace period of 17 days and helen pays her balance in the full every month. if her last billing cycle ended on september 26, 2009, and she made her payment on october 11, 2009, did she owe any interest on her last statement's balance?
Answers: 3
You know the right answer?
Problem 1: Write a function named twoWords that gets and returns two words from a user. The first w...
Questions
question
Mathematics, 25.10.2019 00:43
question
English, 25.10.2019 00:43
question
Mathematics, 25.10.2019 00:43
question
Computers and Technology, 25.10.2019 00:43
question
Mathematics, 25.10.2019 00:43
question
History, 25.10.2019 00:43