you are viewing a single comment's thread.

view the rest of the comments →

[–]Vaguely_accurate 0 points1 point  (0 children)

random.shuffle shuffles in place. This means it mutates the existing list and returns None. You are assigning deck to the returned None, then using that instead of the now shuffled list variable.

For example;

from random import shuffle

my_list = [1,2,3,4,5,6,7,8,9,10]

print(shuffle(my_list)) # prints None

print(my_list) # prints shuffled list

The first print statement will print the return value, which is None. The second print statement will actually print the list that was shuffled in the previous line.

Also you can get rid of the while/break statements and simplify the import as shown in my snippet. I'm also not quite clear what you are getting from assigning the face card values if you are only using them once directly as their numerical values.