Reputation: 3
(starting code) My code is showing (TypeError: 'NoneType' object is not iterable) error even the variable I am using is contains some value. This is the code I am talking about
Upvotes: 0
Views: 174
Reputation: 78
The problem is in how you are appending values to your list users_cards
.
You have written users_cards = users_cards.append(random.choice(cards))
.
The append function automatically updates the object so the code should read: users_cards.append(random.choice(cards))
(no need for the users_cards =
bit)
Upvotes: 1
Reputation: 343
Your user_cards
is None. You need an iterable there (list, tuple etc) because you've used sum
function on that. Make sure user_cards
is initialized.
Upvotes: 0