I'm creating a simple game using an standard deck of cards. At the top, I'm declaring the following:
suits = ('Hearts', 'Diamonds', 'Spades', 'Clubs')
ranks = ('Two', 'Three', 'Four', 'Five', 'Six', 'Seven',
'Eight', 'Nine','Ten', 'Jack', 'Queen', 'King', 'Ace')
values = {'Two':2, 'Three':3, 'Four':4, 'Five':5, 'Six':6, 'Seven':7,
'Eight':8, 'Nine':9, 'Ten':10, 'Jack':10,
'Queen':10, 'King':10, 'Ace':11}
Down below, I use a playing
variable to control the game as follows in simplified version:
while True:
#Initiate the game, instructions etc.
playing = True
if this_happens:
playing = False
break
However, when I run my code through pylint, it returns Constant name "playing" doesn't conform to UPPER_CASE naming style (invalid-name)
.
I checked PEP8 for answer, but I didn't find what exactly is the case. I also tried using playing in a class, since, the top ones are, but the result was the same.
As I understand, variables declared outside of a class or function are global. Since this is the case, why does the following is show for playing
alone since the others are also global? And what would be a good practice in this case?