1 nbsplet l be a list of nonnegative integers where min is


1.  Let L be a list of nonnegative integers, where min is the smallest element and max is the largest element. Write an expression that specifies a new tuple consisting of max copies of min followed by min copies of max. So, for example, if L is [1, 3, 5, 4, 4, 6, 2, 3, 1, 1], then the tuple returned would be (1, 1, 1, 1, 1, 1, 6).

2.Let L be a list of nonnegative integers. Write an expression that replaces the centermost element of L with that many copies of 0. Note that "centermost" here is defined the usual way for a list of odd length, but may seem a bit unusual for a list of even length. So, for example, if L is [1, 2, 3, 4, 5], the modified value of L will be [1, 2, 0, 0, 0, 4, 5], but if L were instead [1, 2, 0, 3], the modified value would be [1, 2, 3], as the 0 - here the centermost element of an even length list - would be replaced with 0 copies of 0.

3.Recall that the .split() method can be used to create a list of words from a string containing multiple words. Write a comprehension that returns a list containing the length, in characters, of all the words in the input sentence that contain the letter 'a'. In other words, if the string were "this is a test", the value returned would be [1], since only the word "a" contains the letter 'a', and that word is 1 character long

 

 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: 1 nbsplet l be a list of nonnegative integers where min is
Reference No:- TGS01115339

Expected delivery within 24 Hours