Hello, 
 I'm a really-green-to-python Biology Grad Student. I;m starting this code so I can assign either a 0 or a 1 at a root node that I will later evolve throughout a tree, but for some reason it is not printing the rootState value.  I know its probably a really stupid mistake, but I can't seem to work it out. Can anyone give me insight why? Thanks. 

import random
from random import random as rnd
from math import exp


class Root:
    """Single Node in a Tree"""

    def __init__( self, rootState ):

       
        self._rootState = rootState
   
        # random choice for root state from a list
        for i in range(1):
            rootState = random.choice([0, 1])


    def __str__( self ):
        """Root string representation"""
   

        return str( self._rootState )
print "The character state at the root is %0.f" % rootState


Hugo Alamillo
Biological Sciences
265 Eastlick
PO Box 644236
Washington State University
Pullman, WA 99164





_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to