To give you some context, the project I'm doing is creating a bill based on inputs from the user, and part of the project outlines a discount if the user would like to pay within 10 days.
Our teacher said we HAVE to nest if statements in our project but I'm not sure why or how.
I missed the nesting lesson and I have no idea how to sucsessfully implement an if statement and everything I can see online is way above my skill level, and I dont see where I'm going wrong with my code.
#finding out the potential discount for paying within 10 days
if pay == "no":
discount = 0
if pay == "yes" and firstBill > 100 and firstBill < 200:
discount = (firstBill * 0.015)
elif pay == "yes" and firstBill > 200 and firstBill < 400:
discount = (firstBill * 0.03)
elif pay == "yes" and firstBill > 400 and firstBill < 800:
discount = (firstBill * 0.04)
elif pay == "yes" and firstBill > 800:
discount = (firstBill * 0.05)
else:
print("error")
else:
print("error")
if pay == "yes"under the== "no"check. That way you don't need to constantly check if it's equal to yes.if pay =="yes"though. You could do that check once and skip all thefirstBillchecks if it isn't "yes".