I’m just starting with Python (with a good amount of VBA under my belt) so I’m playing around with some simple syntax.
I’ve written this simple for-loop but the output seems wrong. I can’t get the variable ‘c’ to increment.
Here is my code:
class Card:
def county(self):
for n in range(0,13):
c = 0
c = c + 1
print c
pick_card = Card()
print pick_card.county()
and the output is just ‘1’ printed 13 times followed by “None”
What am I doing wrong?
Every time through the loop, you’re setting
cto0, then adding1, making it 1.Also, your last line is printing the return value from your function, which doesn’t return anything (hence the “None”)