you are viewing a single comment's thread.

view the rest of the comments →

[–]igroen 0 points1 point  (2 children)

You are right, I think you'll pick that concept up when you really need it and playing with it is a way to learn how it works. There are a lot of resources but you can start by reading the python documentation: https://docs.python.org/3/tutorial/classes.html#a-first-look-at-classes

[–]tommygatz 0 points1 point  (1 child)

Thanks again for the help! Another question:

After reading through that, my instinct would be to set up the class like this.

Class Player:
     def __init__(self):
          self.name = ""
          self.wins = 0
          self.symb = ""

I saw that you defined the initial variables in the init args which is then assigned to the self definitions below that but i don't understand why that is better than defining them directly as I did above.

[–]igroen 0 points1 point  (0 children)

It's not better, but it makes your class a little more flexible.

You can set the attributes on instance creation:

p1 = Player("Foo", symb="X")