'Music Y or Music N

In python, "Music on or music off" . If user selects "Y" music will play, If user selects "N" I don't want music to play etc. Is this a "if, else type thing? Thanks!

from pygame import *
Y = input("Listen To Music While Test Y/N ")
if Y == "Y" or Y == "y":
   print("Enjoy")
else:
   print("Fine be that way")
mixer .init()
mixer.music.load("Sound.wav") 
mixer.music.play(-1,0.0)
while mixer.music.get_busy():
time.Clock().tick(10)


Solution 1:[1]

It doesn't need comment.

import pygame

answer = input("Listen To Music While Test Y/N ")
answer = answer.lower()

if answer == "y":
    print("Enjoy")
    pygame.mixer.init()
    pygame.mixer.music.load("Sound.wav") 
    pygame.mixer.music.play(-1,0.0)
    while pygame.mixer.music.get_busy():
       pygame.time.Clock().tick(10)
else:
   print("Fine be that way")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 furas