Answer:
short_names = ['Gus', 'Bob','Zoe']
Explanation:
A list is a type of data structure in python that allows us to store variables of different types. Each item in a list has an index value which must be a integer value, and the items can be assessed by stating the index position. The syntax for creating and initializing a list is:
list_name = [item1, item2,item3]
- The name of the list (must follow variable naming rules)
- a pair of square brackets
- items in the list separated by commas.
The python code below shows the implementation of the solution of the problem in the question:
<em>short_names = ['Gus', 'Bob','Zoe']</em>
<em>print(short_names[0])</em>
<em>print(short_names[1])</em>
<em>print(short_names[2])</em>
The output is:
<em>Gus</em>
<em>Bob</em>
<em>Zoe</em>
Answer:
Copy formatting lets you copy all the formatting from one object and apply it to another one, think of it as copying and pasting formatting.
Answer:
The base case
Explanation:
Required
The part that determines the termination of a recursion
This part of a recursion is referred to as the base case.
Take for instance, the following:
<em>factorial(int n)
{
</em>
<em> if (n < = 1) { return 1; }
</em>
<em> else { return n*factorial(n-1); } }</em>
<em />
The base case of the above is if (n < = 1) { return 1; }
Because the recursion will continue to be executed until the condition is true i.e. n less than or equals 1