虽然Loop只问我一次问题

时间:2014-11-18 01:37:44

标签: python

我昨晚问了一个类似的问题。我仍然难以让我的while循环工作。

def main():
    lotNumber=""

    output=""

    todayMonth=getValidMonth("the month for Today's Date: ")

    todayDay=getValidDay("the day for Today's Date: ",todayMonth)

    todayYear=getValidYear("the year for Today's Date: ")    

    todayDate=calculateJulianDate(todayMonth, todayDay)

    lotNumber=input("Please enter the next lot number or Q to exit: ")
    if lotNumber.upper()=="Q":
     printingProgramFour(todayMonth, todayDay, todayYear, output)

    while lotNumber.upper()!="Q":
        lotMonth=getValidLotMonth("the month for the date lot " +lotNumber+ " was laid: ")
        lotDay=getValidLotDay("the the day for the date lot " +str(lotNumber) +" was laid: ",lotMonth)
        lotYear=getValidLotYear("the the year for the date lot " +str(lotNumber)+ " was laid: ")
        lotDate=calculateJulianLotDate(lotMonth, lotDay)
        daysOld=todayDate-lotDate
        age=daysOld
        grade=calculateGradeOfEgg(daysOld)
        age=daysOld
        output= +str(output) +str(lotNumber) +"\t" +lotDate +"\t" +age +"\t" +grade+"\n"

        printingProgramFour(todayMonth, todayDay, todayYear, output)
        lotNumber=input("Please enter the next lot number or Q to exit: ")
main()

这是输出:

Please enter the month for Today's Date: 12
Please enter the day for Today's Date: 20
Please enter the year for Today's Date: 2012
Please enter the next lot number or Q to exit: jkbn
Please enter the month for the date lot jkbn was laid: 2
Please enter the the day for the date lot jkbn was laid: 12
Please enter the the year for the date lot jkbn was laid: 2012

然后程序停止。 :'(

我需要一些帮助,我不知道为什么这不会起作用!!!!请拜托!

非常感谢你。非常感谢您的帮助。

0 个答案:

没有答案