python - Calling a function not working -
i have blackjack game working great (first project, still beginner). keep looping once game finished need implement functions , classes think.
without copying on of code, skeleton of project far. split 2 functions because think makes little neater... if shouldn't that, let me know.
(couple of imports) (couple of variables declared) class game: def newgame(self): (code) (game.choices) def choices(self): (code) (game.newgame) game.newgame()
shouldn't call first function, in turn call second function?
newgame
needs object before can called (that's why self parameter) this:
x = game() x.newgame()
or (as pointed out in comments):
game().newgame()
Nice post.
ReplyDeletePython Online Training