On Tuesday, October 18, 2016 at 9:25:19 PM UTC+1, Sayth Renshaw wrote: > So why can't i assign the result slice to a variable b? > > It just keeps getting none. > > Sayth
You are misunderstanding something that is fundamental in Python, namely that anything that is done inplace *ALWAYS* returns None as a warning that the operation has been done inplace, so you're never going to get anything back. All you need do is change your original code as follows:- from random import shuffle a = [1,2,3,4,5] shuffle(a) b = a[:3] print(b) Kindest regards. Mark Lawrence. -- https://mail.python.org/mailman/listinfo/python-list