I've not long started with python and I've looked over a lot of posts on here but just cant seem to work out whats wrong with my code... If the user types in N or n then surely my elif would kick in but it still plays the sound and prints out "sound played". Can anyone help please? Thank you.
test2 = raw_input("Would you like to test the sound? Y\N or exit? ")
if test2 == "Y" or "y":
winsound.PlaySound('C:/Windows/Media/tada.wav', winsound.SND_FILENAME)
print ("Sound Played")
elif test2 == "N" or "n":
print ("Test skipped")
elif test2 == "exit":
print ("Test exit")
else:
print ("Please choose an option")
Aucun commentaire:
Enregistrer un commentaire