A database management system<span> (DBMS) is system software for creating and managing databases. The DBMS provides users and programmers with a systematic way to create, retrieve, update and manage data.</span>
Answer:
The solution code is written in Python.
- play_list = [2, 4, 6, 8, 10]
- play_list[0] = 2 * play_list[len(play_list) - 1]
-
- print(play_list)
Explanation:
Firstly, we create a non-empty list, <em>play_list</em>, and fill it up with five random integers (Line 1).
To associate the new value with the first element of the list, we use expression play_list[0]. The index 0 address to the first element of the list.
Next, we use expression, len(play_list) - 1 to get the last index of the list and use that calculated last index to take out the last element and multiply it with 2. The result of multiplication is assigned to the first element, play_list[0] (Line 2).
When we print the list, we shall get
[20, 4, 6, 8, 10]
Answer:
Written in Python:
def list_length(shrinking_list):
if not shrinking_list:
return 0
else:
return list_length(shrinking_list[1:]) + len(shrinking_list[0])
Explanation:
This defines the list
def list_length(shrinking_list):
This checks if list is empty, if yes it returns 0
<em> if not shrinking_list:</em>
<em> return 0</em>
If list is not empty,
else:
This calculates the length of the list, recursively
return list_length(shrinking_list[1:]) + len(shrinking_list[0])
To call the function from the main, use:
<em>print(list_length(listname))</em>