Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started