on-internet
← Community

VS Code linter is saying Python variables that change using += 1 should be constants. Is this correct? [duplicate]

Stack Overflow ·

Here is a simplified version of my code: foo = 0 bar = 0 baz = 0 while True: answer = input('Type an input here: ') print('And do something with it here.') if answer == 'okay': foo += 1 else: bar += 1 baz += 1 print(foo, bar, baz) When I save this, VS Code is giving me a warning saying: Constant name "foo" doesn't conform to UPPER_CASE naming style Constant name "bar" doesn't conform to UPPER_CASE naming style Constant name "baz" doesn't conform to UPPER_CASE naming style My question is does the += 1 affect whether or not the variable should be a constant? I thought the += 1 would cause it to

Comments

Sign in or sign up to comment and upvote.

No comments yet.