random.sample returns list. But you put this in square brackets, so it becomes list of lists with one element,e .g.
you can easily check this if print it immediately after line 5.
[[93, 15, 58, 11, 35, 67, 36, 33, 42, 63]]
you can easily check this if print it immediately after line 5.
import random def listing(): lst = random.sample(range(1,100),10) return [lst[0], lst[-1]] print(listing())Also, don't use list as variable name.
list()
is built-in function and using list
as a variable name the function is no longer available
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs