Answer:
The code with explanatory comments are given in Python below
Step-by-step explanation:
#2.22
s = "Lionel Pogba" #string s with names having LP as initials
names = s.split() #splits the string into individual characters
initial = "" #we are initialising the initials as an empty string
for i in names:
initial += i[0] #making the initials of the string
print(initial)
#2.23
l = [3, 7, -2, 12]
range = (max(l) - min(l)) #declare and initialise variable range for the range
print(range) #output of the range
#2.24
l1 = [3, 7, 17, -2, 12]
#(a)
midIndex = int(len(l1)/2) #evaluates half the length of the list
#which corresponds to the middle index of the list
print(midIndex)
#(b)
print(l1[midIndex]) #assigns the value of the middle index of the list
#corresponding to the middle element
#(c)
l1.sort(reverse=True) #reverses the elements of the list to descending order
print(l1)
#(d)
firstValue = l1[0] #firstValue variable representing the first element
l1 = l1[1:] + [firstValue] #assigning the location to the last position
print(l1)