Python infinite loop, kill flag wont stop correctly

This has had me stumped for the last day, I'm rather new to python. I have been trying to get my kill flag in a while loop to work so I can move on with the rest of my code. Basically its suppose to take input from the user display what the user input, do a small tax calculation and take the next input. It will continue to cycle through taking inputs but I can't get it to stop when I enter "-1" as the kill flag. Any suggestions? This is not the complete code I do have functions and variables and they seem to be working as they should.

while saleID != -1:

saleID = input("Please enter the sale ID: ")

count = count + 1 

preTaxAmount = float(input("Please enter pretax amount of sale: "))

postTaxAmount = (preTaxAmount *(1 + taxRate))

totalPostTaxAmount += postTaxAmount
  
getPostTaxAmount(taxRate,preTaxAmount)

totalPostTaxAmount = getPostTaxAmount(preTaxAmount, taxRate)

averagePostTax = totalPostTaxAmount/count

if ( postTaxAmount > highestPostTax):

    highestPostTax = postTaxAmount
    
    highSaleID = saleID

salesReport(saleID,preTaxAmount,postTaxAmount)
if saleID == -1:

print(finalReport(state,date,taxRate,count, totalPreTaxAmount, totalPostTaxAmount, averagePostTax,highestPostTax,highSaleID))


from Recent Questions - Stack Overflow https://ift.tt/3rwaPfD
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Object oriented programming concepts (OOPs)

Spring Webflux : How to return HTTP 200 response with body when the called service returns HTTP 201 without body with WebClient?