I have two running counts in this code, and when I hit 'stop' to get a summary, the entries that should populate my running count are returning 0. It was working and then it wasn't, and I have no idea why.
print ('Property Type Taxes')
n = str() #Property Type
m = float() #Amount of taxes
totalC = float(0.0) #total taxes of Commercial property
totalR = float(0.0) #total taxes of Residential property
while True:
n = input()
if n == 'stop':
print ('Sum of Taxes' ' ' 'Average of Taxes')
print ('Residential Properties' ' ', totalR)
print ('Commercial Properties' ' ', totalC)
m = float(input())
print (n, ' ', m)
if n == ('Commercial' or 'commercial'):
totalC += m
elif n == ('Residential' or 'residential'):
totalR += m
There's only so much teaching my professor has actually done and the textbook we're using is extremely limited. I could not understand the variety of 'while' conditions, so I had while n != 'stop'
as the condition and then I changed it to while True
after seeing another thread. It worked after this and then stopped working after a few tries without having changed anything else.