By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,101 Members | 1,394 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,101 IT Pros & Developers. It's quick & easy.

last 2 songs in python will not play only the first 2 if i try and play the 3rd or 4t

P: 1
i added 2 more songs and now it wont play the last 2 if i type "Where You Been" witch is the last one it plays the "Trigger Finger" and it also does that with the "Crack" one but it will play "Fork" when i type it im confused how it only lets me play the first two there is no errors here is my code...
Expand|Select|Wrap|Line Numbers
  1. import pygame
  2. from pygame.locals import *
  3.  
  4. pygame.mixer.init()
  5. start = 1
  6. chainz_1 = pygame.mixer.Sound("fork.ogg")
  7. lilwayne_1 = pygame.mixer.Sound("TF.ogg")
  8. chainz_2 = pygame.mixer.Sound("Crack.ogg")
  9. chainz_3 = pygame.mixer.Sound("WhereYouBeen.ogg")
  10.  
  11. while True:
  12.     print("What song would you like to play? ")
  13.     print("Fork")
  14.     print("Trigger Finger")
  15.     print("Crack")
  16.     print("Where You been")
  17.     choice = input()
  18.  
  19.     if choice == "Fork":
  20.       chainz_1.set_volume(0.2)
  21.       chainz_1.play()
  22.       wn = input()
  23.       if wn == "Stop" or "stop":
  24.       chainz_1.stop()
  25.       continue
  26.     if choice == "Trigger Finger" or "tf" or "trigger finger":
  27.       lilwayne_1.set_volume(0.15)
  28.       lilwayne_1.play()
  29.       wn = input()
  30.       if wn == "Stop" or "stop":
  31.       lilwayne_1.stop()
  32.       continue
  33.     if choice == "Crack" or "crack":
  34.       chainz_2.set_volume(0.2)
  35.       chainz_2.play()
  36.       wn = input()
  37.       if wn == "Stop" or "stop":
  38.       chainz_2.stop()
  39.       continue
  40.     if choice == "Where You Been" or "where you been" or "wyb":
  41.       chainz_3.set_volume(0.2)
  42.       chainz_3.play()
  43.       wn = input()
  44.       if wn == "Stop" or "stop":
  45.       chainz_3.stop()
  46.       continue
  47.  
Oct 29 '14 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,359
This
Expand|Select|Wrap|Line Numbers
  1. if choice == "Trigger Finger" or "tf" or "trigger finger":
Needs to be this
Expand|Select|Wrap|Line Numbers
  1. if choice == "Trigger Finger" or choice == "tf" or choice == "trigger finger":
The same goes for the rest of your code.
Oct 29 '14 #2

Expert 100+
P: 618
It is simpler when using numbers
Expand|Select|Wrap|Line Numbers
  1.     print("What song would you like to play? ")
  2.     print("""
  3. 1. Fork
  4. 2. Trigger Finger
  5. 3. Crack
  6. 4. Where You been
  7. """
  8.      choice = input("Enter 1->4 ")
  9.      choice = int(choice)
  10.  
  11.      if choice == 1:
  12.        chainz_1.set_volume(0.2)
  13.        chainz_1.play()
  14. ##
  15. ## etc. 
Oct 30 '14 #3

Post your reply

Sign in to post your reply or Sign up for a free account.