循环此程序的最佳方法是什么

时间:2015-12-01 19:40:11

标签: python-3.5

count = 0
while (count >4):
    fixedcosts = float(input("Enter fixed costs: "))
    salesprice = float(input("Enter the price for one unit: "))
    variablecosts = float(input("Enter the variable costs for one unit: "))
    contribution = float(salesprice)-float(variablecosts)
    breakevenpoint = float(fixedcosts)/float(contribution)
    roundedbreakevenpoint = round(breakevenpoint)
    #Finds break even point
    if int(roundedbreakevenpoint) < float(breakevenpoint):
        breakevenpoint2 = int(roundedbreakevenpoint) + 1
        print("Your break even point is ",int(breakevenpoint2),"units")
    else:
        print("Your break even point is ",int(roundedbreakevenpoint),"units")
    #Finds number of units needed to make a profit
    if int(roundedbreakevenpoint) < float(breakevenpoint):
        breakevenpoint3 = int(roundedbreakevenpoint) + 2
        print("To make a profit you need to sell ",int(breakevenpoint3),"units")
    else:
        int(roundedbreakevenpoint) >= float(breakevenpoint)
        breakevenpoint4 = int(roundedbreakevenpoint) + 1
        print("To make a profit you need to sell ",int(breakevenpoint4),"units")
    decision = input("Would you like to restart the program?")
    if decision == 'yes' or 'Yes':
        count = count + 1
        print("This program will now restart")
    else:
        print("This program will now be terminated")
        print("Press enter to stop the program")
        quit()

循环此代码的最佳方法是什么?我尝试过while循环,但我似乎无法使用是的答案。

0 个答案:

没有答案