- 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
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.
+ 2
Hi! Where?