mercredi 6 novembre 2019

Why isn't my if condition always executing and not the elif or else condition?

//Hi... I'm kind of new to coding but I do know that this is a really basic and silly question. But I can't get my head around this particular if..else statement. So here is my code: //

print("Do you want to run the next bit of code? Y/N") n = input()

if n == "Y" or "y": j = [12, 43, 54, 65] for i in j: print (i, end="" "\t")

elif n == "N" or "n": print("You get numbers if you had pressed Y")

else: print("That's not an option")

// My problem here is, whatever the value I give for n, it always gives me the output of Y or y. I always get the output as the array numbers. Which means that my condition is not working. So what is actually the problem with the first condition?

Aucun commentaire:

Enregistrer un commentaire