Alright, now I'm trying to make some elif statements work, but for some reason, I'm stuck in an infinite while loop. Here's the code:
counter = 0
heard = ""
while counter < 5:
print("Go play some Donkey Kong Country 2 for Super Nintendo!")
heard = input("Did you hear what I said?")
if heard != "n" or heard != "y":
print("Invalid entry. Enter y for yes, or n for no.")
continue
elif heard == "n" and counter < 5:
counter += 1
continue
elif heard == "y" and counter < 5:
print("Alright! Don't forget to collect all the Kremcoins too.")
break
elif heard == "n" and counter == 5:#5 no end statement
print("Say what one more time! I dare you MF! Say what again!")
break # is this break really necessary, since the counter is now 5?
However, the output is this:
======= RESTART: I:\Python\Python36-32\SamsPrograms\WhileLoopBasics.py =======
Go play some Donkey Kong Country 2 for Super Nintendo!
Did you hear what I said?k
Invalid entry. Enter y for yes, or n for no.
Go play some Donkey Kong Country 2 for Super Nintendo!
Did you hear what I said?k
Invalid entry. Enter y for yes, or n for no.
Go play some Donkey Kong Country 2 for Super Nintendo!
Did you hear what I said?k
Invalid entry. Enter y for yes, or n for no.
Go play some Donkey Kong Country 2 for Super Nintendo!
Did you hear what I said?k
Invalid entry. Enter y for yes, or n for no.
Go play some Donkey Kong Country 2 for Super Nintendo!
Did you hear what I said?k
Invalid entry. Enter y for yes, or n for no.
Go play some Donkey Kong Country 2 for Super Nintendo!
Did you hear what I said?n
Invalid entry. Enter y for yes, or n for no.
Go play some Donkey Kong Country 2 for Super Nintendo!
Did you hear what I said?n
Invalid entry. Enter y for yes, or n for no.
Go play some Donkey Kong Country 2 for Super Nintendo!
Did you hear what I said?n
Invalid entry. Enter y for yes, or n for no.
Go play some Donkey Kong Country 2 for Super Nintendo!
Did you hear what I said?n
Invalid entry. Enter y for yes, or n for no.
Go play some Donkey Kong Country 2 for Super Nintendo!
Did you hear what I said?n
Invalid entry. Enter y for yes, or n for no.
Go play some Donkey Kong Country 2 for Super Nintendo!
Did you hear what I said?n
Invalid entry. Enter y for yes, or n for no.
Go play some Donkey Kong Country 2 for Super Nintendo!
Did you hear what I said?
As you can see, the while loop continues after I entered the k four times because k is not a valid entry, but why doesn't it jump down to:
elif heard == "n" and counter == 5:#5 no end statement
I've entered n more than five times, haven't I? What's going on?