Member Avatar for leegeorg07

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

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.

Member Avatar for leegeorg07

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.