- 1

Why this isn't working properly?

from pygame import mixer mixer.init( ) mixer.music.load( "song.mp3" ) mixer.music.set_volume( 0.7 ) mixer.music.play( ) while True: print( "press 'p' to pause 'r' to resume '' ) print( "press 'e' to exit the program '' ) query = input( ">>> " ) if query == 'p' : mixer.music.pause( ) elif query == 'r' : mixer.music.unpause( ) elif query == 'e' : mixer.music.stop( ) break

19th Sep 2022, 7:17 AM
Devid Ji
2 Answers
+ 3
The code asks for user input in a loop, which means it needs to be running in an interactive environment. Interactive input/output is not available in SoloLearn, thus you need to test the code in your PC/laptop where interactivity is supported.
19th Sep 2022, 8:45 AM
Ipang
+ 2
Hi! Where?
19th Sep 2022, 7:56 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar