Jump to content

electronuke2

Member
  • Posts

    10
  • Joined

  • Last visited

Reputation Activity

  1. Like
    electronuke2 reacted to WanderingFool in Java to Python   
    That really isn't helpful...perhaps he is just learning programming which would mean not being able to easily transfer over languages.
     
    Anyways @electronuke2 I have never used Python before, but I think the following is roughly correct.
     
    class SlotMachine: def __init__(self): self.randomNumber = 0 def changeNumber(self): self.randomNumber = (int(random.Random()) % 4) + 4SlotMachine sm = SlotMachine()sm.changeNumber()print sm.randomNumbersm.changeNumber()print sm.randomNumbersm.changeNumber()print sm.randomNumber Anyways, I have always been too lazy to learn Python (or even install it)....so this might not even work at all.  I think it is roughly similar to your original code (minus the memory portion)
×