Healthy Programmer .Exercise.7
from pygame import mixer from datetime import datetime from time import time def mplay (file , stopper): mixer.init() mixer.music.load(file) mixer.music.play() while True : userinput = input () if userinput == stopper: mixer.music.stop() break def logactivity (msg): with open ( "Your Acvivity" , "a" ) as f: f.write( f" { msg } { datetime.now() } " ) if __name__ == '__main__' : water= 5 eyes= 10 phy= 15 init_water = time() init_eyes = time() init_exercise = time() while True : if time() - water > init_water: print ( "It is water drinking time.Enter=completed for stop the alarm" ) mplay( 'water.mp3' , 'completed' ) logactivity( " \n Water drink at:" ) if time() - eyes > init_eyes: print ( "It is eyes excrise time.Enter=completed for stop the alarm" ) mplay( 'eye.mp3' , 'comp...