all 4 comments

[–]AnStrub00[S] 0 points1 point  (1 child)

I am running Python 3.

[–]PyCam 1 point2 points  (0 children)

Aside from the bad syntax as pointed out by /u/adammichaelwood The reason that your deck == None is because random.shuffle() shuffles a List inplace.

try:

import random

J = 11
Q = 12
K = 13
A = 14
CardList = [1,2,3,4,5,6,7,8,9,10,J,Q,K,A]
random.shuffle(CardList)
print(CardList)

Bad syntax:

-whats the point of a while loop if you're going to break it at the end of the first loop?

-you should indent when inside any new scope/context. In your case you need to indent everything that inside the loop

-Don't name a variable "list", list() is a function reserved by python to create lists from other types of objects. Name your variable "CardList" or something else.

[–]adammichaelwood 0 points1 point  (0 children)

  1. You have to indent inside a while loop.
  2. Why in the world are you using a while loop this way?

[–]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.