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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marcus7021
    New Member
    • Oct 2014
    • 1

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

    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...
    Code:
    import pygame
    from pygame.locals import *
    
    pygame.mixer.init()
    start = 1
    chainz_1 = pygame.mixer.Sound("fork.ogg")
    lilwayne_1 = pygame.mixer.Sound("TF.ogg")
    chainz_2 = pygame.mixer.Sound("Crack.ogg")
    chainz_3 = pygame.mixer.Sound("WhereYouBeen.ogg")
    
    while True:
        print("What song would you like to play? ")
        print("Fork")
        print("Trigger Finger")
        print("Crack")
        print("Where You been")
        choice = input()
    
        if choice == "Fork":
          chainz_1.set_volume(0.2)
          chainz_1.play()
          wn = input()
          if wn == "Stop" or "stop":
          chainz_1.stop()
          continue
        if choice == "Trigger Finger" or "tf" or "trigger finger":
          lilwayne_1.set_volume(0.15)
          lilwayne_1.play()
          wn = input()
          if wn == "Stop" or "stop":
          lilwayne_1.stop()
          continue
        if choice == "Crack" or "crack":
          chainz_2.set_volume(0.2)
          chainz_2.play()
          wn = input()
          if wn == "Stop" or "stop":
          chainz_2.stop()
          continue
        if choice == "Where You Been" or "where you been" or "wyb":
          chainz_3.set_volume(0.2)
          chainz_3.play()
          wn = input()
          if wn == "Stop" or "stop":
          chainz_3.stop()
          continue
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    This
    Code:
    if choice == "Trigger Finger" or "tf" or "trigger finger":
    Needs to be this
    Code:
    if choice == "Trigger Finger" or choice == "tf" or choice == "trigger finger":
    The same goes for the rest of your code.

    Comment

    • dwblas
      Recognized Expert Contributor
      • May 2008
      • 626

      #3
      It is simpler when using numbers
      Code:
          print("What song would you like to play? ")
          print("""
      1. Fork
      2. Trigger Finger
      3. Crack
      4. Where You been
      """
           choice = input("Enter 1->4 ")
           choice = int(choice)
      
           if choice == 1:
             chainz_1.set_volume(0.2)
             chainz_1.play()
      ##
      ## etc.

      Comment

      Working...