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()  

Comments

Post a Comment

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -