Hey,

I've been trying to write a function to find the Lowest Common Multiple of two numbers, but it isn't working and I've kinda hit a dead end on the thought-process end of things. Anyone mind looking at it, and tell me what's wrong? (I hop you don't think it's too long to put in an email)

Code:

def lowestCommonMultiple(a, b, amount): #k
    float(amount)
    if a == b:
        print 'You cannot find the LCM of the same number twice.'
    else:
        numbersList = list(range(amount))
        aMultiples = []
        bMultiples = []
        for aNumber in numbersList:
            aMultiples.append(a*aNumber)
        for bNumber in numbersList:
            bMultiples.append(b*bNumber)
        if aMultiples[1] == bMultiples[1]:
            print 'The LCM of ', a, ' and ', b, ' is ', aMultiple[1]
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to