back with more issues

Kris Mesenbrink krismesenbrink at gmail.com
Mon Aug 12 02:31:32 EDT 2013


darn i was hoping i could put off learning classes for a bit, but it seems that is not the case. i have tested it a bit and it seems to be working correctly now.

++++++++++++++++++++++++++++
import random

class player():
    hp = 10
    speed = 5
    attack = random.randint(0,5)

print (player.attack)

+++++++++++++++++++++++++++++++++++

i know it's not nearly as complicated as your examples but it seems to work. the self part of it always eluded me and continues to do so. and just so you know im learning through codecademy.com , it's based on python 2.7 and im trying to code in 3.3. but thanks for your help again and classes are starting (i think) to make some sort of sense.i'll have to reread both replies over and over again but it looks like a lot of useful info is there. but is the example i posted sorta right? i know i left the self part out but i think im on the right track.



More information about the Python-list mailing list