# Code by "unhappy".
# Find me at: https://www.grepper.com/profile/unhappy
# From pygame (pip install pygame) import mixer as "Player"
from pygame import mixer as Player
# Initiate the pygame mixer
Player.init()
# Load a song from its file location.
# Replace the "your_song_file_location.mp3"
# with the file path of your song
Player.music.load("your_song_file_location.mp3")
# Get the user input for what they want to do
Choice = input(
"""Input your choice:
1) Start the song
2) Stop the song
3 (or any other key)) Exit program"""
)
# If the user put in their choice as "1"
if Choice == "1":
# Start the song
Player.music.play()
# If the user put in their choice as "2"
if Choice == "2":
# Stop the song
Player.music.stop()
# Otherwise
else:
# Stop the song
Player.music.stop()
# Quit the player
Player.quit()