Question: python3 (1a) Complete the examples in the docstring and then write the body of the following function: def diff_first_last(L): '' (list) -> boolean Precondition: len(L)

python3

(1a) Complete the examples in the docstring and then write the body of the following function: def diff_first_last(L):

'' (list) -> boolean Precondition: len(L) >= 2

Returns True if the first item of the list is different from the last; else returns False.

>>> diff_first_last([3, 4, 2, 8, 3])

False

>>> diff_first_last(['apple', 'banana', 'pear'])

??

>>> diff_first_last([4.0, 4.5])

?? '''

(1b) Add two more examples/test cases to the docstring of diff_first_last and indicate why they are useful test cases.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!