Ask coding questions

← Back to all posts
Why do i always get None for p.bet
TejasvMaheshwar (7)

So am trying to make a blackjack game as project from my python course and i have to use classes no matter what

Whenever someone puts in the wrong input , I want my functions to run again and ask again for the input until a proper input is given.

I have made a bet() function in a different class (inputs) and am storing its return value in another class (player)

But when i print player.bet i always get None

please help me with this

Comments
hotnewtop
SixBeeps (5347)

Careful, self isn't a regular parameter, so you can't just pass a value to it. Your best bet would be to move all of your input functions from out of its own class and into the Player class so you don't have to deal with that. If you choose to do so, you can keep the self object.