I can't figure out why when adding a newPerson(), my code isn't assigning a value to the state attribute. I used nearly the same syntax for my color attribute and there's no issue with it.Here's my newPerson() function
Asked
Active
Viewed 26 times
-3
-
1Please include all the relevant code - and **only** the relevant code - as text in the question itself. See how to create a [mre] so that we can run and reproduce your problem. – Thierry Lathuille May 12 '20 at 17:38
-
Welcome to SO! Any chance you can copy and paste your code into the question using code blocks? You would do that by surrounding your code with three backticks (```) before and after. – Lateralus May 12 '20 at 17:38
1 Answers
0
In your Person class, it looks like when you set self.state, you're assigning it to be a value that you're not passing it. You're code reads:
self.state = kwargs.get('susceptible')
but I think it should read:
self.state = kwargs.get('state', 'susceptible')
This reads the state parameter and sets the default to be susceptible. Here's a link that may be of help: Proper way to use **kwargs in Python

Rohin Dasari
- 86
- 1
- 5