Why is the 'if statement' getting ignored?

P

Pablo

Guest
print("10 apples on a tree")
userChoice = input("Would you like to change the amount on apples ([Y]/[N]): ")

if userChoice == 'Y':
appleAmount = input("Please enter the amount of apples: ")

if appleAmount == 1:
print("1 apple on a tree")
else:
print(appleAmount, "apples on a tree")

if userChoice == 'N':
print("Okay.")


When ever I run my code, and enter '1'. It prints out "1 apples on a tree" instead of "1 apple on a tree" as I have wrote it. Struggling to pin point the problem.

My goal is, allowing the user to modify the amount of apples. If they decide to type in '1' then the word "apples" needs to change to "apple".

I have googled around and this is how everyone does the if statements but surely somethings wrong somewhere or have I missed something out.

Continue reading...
 
Top