Answer:
In Python:
def fib(nterms):
n1, n2 = 1, 1
count = 0
while count < nterms:
term = n1
nth = n1 + n2
n1 = n2
n2 = nth
count += 1
return term
Explanation:
This line defines the function
def fib(nterms):
This line initializes the first and second terms to 1
n1, n2 = 1, 1
This line initializes the Fibonacci count to 0
count = 0
The following while loops gets the number at the position of nterms
<em> while count < nterms:
</em>
<em> term = n1
</em>
<em> nth = n1 + n2
</em>
<em> n1 = n2
</em>
<em> n2 = nth
</em>
<em> count += 1
</em>
This returns the Fibonnaci term
return term
Example of intermediate technology is the treadle pump, which enables farmers to provide a greater amount of water to their plants more easily compared to watering by bucket, while requiring much less infrastructure than constructing irrigation dams and pipes.
The answer is B. book mark definitely
Answer:
Option A: FileNotFoundError
Explanation:
FileNotFoundError is an exception which is thrown when a program fail to open a specified file. The root causes of this type of error can be:
- The directory path to locate a target file is wrongly defined in our code due to a typo on the file name or misuse of relative directory path, such as ../ and ./ which denote two different paths.
- For some reasons, a target file is misplaced in a wrong directory.
Any one of the above reasons can lead to the exception to be thrown when the file doesn't exist.
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>