Create your own


#1

I don't know what I'm doing wrong. My brother's no help right now insisting that the else statement is in the wrong place. Other examples explicitly show otherwise.

EDIT: Not sure why this works, but not what I want.


#2

Not sure inputing inside the for loop is the way to go. I would use while. Also, by convention we do not start variable names with a capital letter, as this is reserved for classes.

choices = [ ... ]
print " ... "
chances = 3
while True:
    choice = raw_input(" ... ")
    if choice in choices:
        print "Here you go, your, %s" % choice
        break
    else:
        chances -= 1
        if chances < 1:
            print "out of chances"
            break

`


#3

That makes sense. I got them confused.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.