member variable string gets treated as Tuple in Python

You've got a comma after those attributes in your constructor function.

Remove them and you'll get it without a tuple


yes, you have to remove comma from instance variables. from self.model = model, to self.model = model

Nice to see, you are using Class variable concept, "condition" is class variable and "self.model", "self.color", "self.mpg" are instance variables.


In your __init__, you have:

    self.model = model,
    self.color = color,

which is how you define a tuple. Change the lines to

    self.model = model
    self.color = color

without the comma:

>>> a = 2,
>>> a
(2,)

vs

>>> a = 2
>>> a
2

Tags:

Python

Class