0

Hi, I have this code:

def yn(input):
    if input.lower == 'y':
        return True
    else:
        return False
def limestone():
    I = raw_input("are there shelly fragments? (y/n)")
    if yn(I):
        print "Shelly limestone"
    else:
        print "chalk"
def crystals():
    I = raw_input("Are the crystals big?(y/n)")
    if yn(I):
        big_crystals()
    else:
        print "Basalt"
def big_crystals():
    I = raw_input ("Are the crystals pink? (y/n)")
    if yn(I):
        print "Granite"
    else:
        print "Gabbro"
def layer_grains():
    I = raw_input("Can you see layers? (y/n)")
    if yn(I):
        print "Shales"
    else:
        print "Mudstone"
def large_grains():
    I = raw_input("Are the grains sand sized? (y/n)")
    if yn(I):
        print "Sandstone"
    else:
        print "Conglonerate"
def big_grains():
    I = raw_input("Are the grains big enough to see? (y/n)")
    if yn(I):
        large_grains()
    else:
        layer_grains()
def gc():
    I = raw_input("are there grains? (y/n)")
    if yn(I):
        big_grain()
    else:
        crystals()
def lc():
    I = raw_input("Does acid make the rock fizz? (y/n)")
    if yn(I):
        limestone()
    else:
        gc()
    
while 1:
    lc()

but for some reason it will always go to gc() after lc(), why wont it return true and how can I fix it?

thanks in advance

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by leegeorg07
0

Don't use input as a variable name. Input is a python function that is equivalent to eval(raw_input(...)) ...

This may not solve your problem but it will help to distinguish whether this is a true problem or just semantics

EDIT: Now I see it. you have to call lower(). Right now you're just checking the reference to the class instead of instantiating it. But still heed my suggestion above.

0

Oh yeah thanks, that worked out fine, my science teacher will be very happy at his new decision engine :D

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.