[Tutor] RuntimeError: maximum recursion depth exceeded

James Stauble james.stauble at gmail.com
Thu Apr 19 21:51:03 CEST 2012


I have seen in a few places where this means my program is essentially in
an endless loop, but as far as I can see it is formatted correctly. Any
help would be greatly appreciated. Thanks in advance.



 #This function defines the main calls in this program
def main():
    mealPrice = getMeal()  #call to get the meal price before tip and tax
    tipPercent = getTip(mealPrice)  #call to get the total tip based on
meal price
    stateTax = getTax(mealPrice)    #call to get the total tax based on
meal price
    mealTotal = getTotal(mealPrice,tipPercent,stateTax) #call to get the
total cost including tip and tax
#This function gets the original meal price before tax and tip are added
def getMeal():
    mealPrice = input ('Enter the price of the meal $ ')
    mealPrice = float (mealPrice)
    return mealPrice
#This function gets the tip which will be added to the meal
def getTip(mealPrice):
    tipPercent = getTip(mealPrice)
    if mealPrice >= 25.01:
        tipPercent == .22
    elif mealPrice >= 17.01:
        tipPercent == .19
    elif mealPrice >= 12.01:
        tipPercent == .16
    elif mealPrice >= 6:
        tipPercent == .13
    else:
        tipPercent == .10
    return tipPercent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120419/d1b00b06/attachment.html>


More information about the Tutor mailing list