I am making a shopping program for school and everything was fine until I ran it before I submitted it. when I input 'n' for the 5th line, it runs the if statement anyway. I have checked over it a bunch of times but I can't seem to find anything wrong. I would appreciate it if you could help.
price1 = float(input('Cost of the first product($): '))
mass1 = float(input('Mass of the first product(g): '))
price2 = float(input('Cost of the second product($): '))
mass2 = float(input('Mass of the second product(g): '))
yes = input ("Do you want to add another product? ")
if yes == 'y' or 'yes':
price3 = float(input('Cost of the third product($): '))
mass3 = float(input('Mass of the third product(g): '))
total1 = price1/mass1
total2 = price2/mass2
total3 = price3/mass3
print('The unit price of Product One is', total1, '$/g.')
print('The unit price of Product two is', total2, '$/g.')
print('The unit price of Product three is', total3, '$/g.')
if total1 < total2 and total1 < total3:
print ('Product one is of better value.')
elif total2 < total1 and total2 < total3:
print ('Product two is of better value.')
elif total3 < total2 and total3 < total1:
print ('Product three is of better value.')
else:
print ('All products are of equal value.')
elif yes == 'n' or 'no':
total1 = price1/mass1
total2 = price2/mass2
print('The unit price of Product One is', total1, '$/g.')
print('The unit price of Product One is', total2, '$/g.')
if total1 < total2:
print ('Product one is of better value.')
elif total2 < total1:
print ('Product two is of better value.')
else:
print ('Both products are of equal value.')