vendredi 18 mars 2016

I am getting a syntax error in a very simple less than or equal to if statement

Sorry if I'm making a simple mistake but I really can't figure this out. I need to create a change machine for my computer science class and I know I've used a less than or equal to statement, but for some reason its not working now.

    Amount= float(input("What is the dollar amount?"))

    Change = 0
    q = 0
    d = 0
    n = 0
    p = 0

    while Amount > 0:
        if Amount >= .25:
            Q = Amount - .25
            q += 1
        elif Amount > .10 and <= .25:
            D = Amount - .10
            d += 1
        elif Amount > .05 and <= .10:
            N = Amount - .05
            n += 1
        elif Amount < .05:
            P = Amount - .01
            p += 1



    print q
    print d
    print n
    print p`

    line 18
          elif Amount > .10 and <= .25
                         ^
    SyntaxError: invalid syntax

Aucun commentaire:

Enregistrer un commentaire