[SOLVED] I want to play a sound while the countdown is running

Issue

This Content is from Stack Overflow. Question asked by stop

I have a code which plays sound and a timer that decreases overtime but the problem is I don’t know how to play the sound while the timer counts down.

    seconds = 10

for i in range(seconds):
    print(str(seconds-i) + " seconds remaining n")
    t.sleep(1)
playsound('music.mp3')



Solution

seconds = 10

for i in range(seconds):
    print(str(seconds-i) + " seconds remaining \n")
    t.sleep(1)
    playsound('music.mp3')

Bruh -_- just put an tab space so that the music enters the for loop


This Question was asked in StackOverflow by stop and Answered by Yash Takhtani It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?