Python program for healthy schedule Please review my program and give some tips . I am a beginner. IT is for those people who sit on computer all day and get unhealthy . This will remind them to do eye exercise , physical exercise and to drink water
import pygame
import time

t = time.ctime(time.time())
# noinspection SpellCheckingInspection
totalbreaks2 = 17
# noinspection SpellCheckingInspection
breakcount2 = 0
# noinspection SpellCheckingInspection
totalbreaks = 16
# noinspection SpellCheckingInspection
breakcount = 0
# noinspection SpellCheckingInspection
totalbreaks1 = 10
# noinspection SpellCheckingInspection
breakcount1 = 0


# noinspection SpellCheckingInspection
def health():
    # global keywords
    global breakcount2
    global breakcount
    global breakcount1
    global totalbreaks1
    global totalbreaks
    global totalbreaks2
    # water program
    if breakcount2 &lt; totalbreaks2:
        pygame.mixer.init()
        pygame.mixer.music.load(&quot;water.mp3.mp3&quot;)
        pygame.mixer.music.play(-1)
        query = input('Did you drink water (type drank if yes)?')
        if query == 'drank':
            with open('water.txt', 'r+') as o:
                o.write(f'You drank water at {t} ')
            pygame.mixer.music.pause()
            time.sleep(120)
            breakcount2 += 1
    # eye program
    if breakcount &lt; totalbreaks:
        pygame.mixer.init()
        pygame.mixer.music.load(&quot;eyes.mp3.mp3&quot;)
        pygame.mixer.music.play(-1)
        query = input('Did you do eyes exercise ?(type eydone if yes)')
        if query == 'eydone':
            with open('water.txt', 'r+') as o1:
                o1.write(f'You drank water at {t} ')
            pygame.mixer.music.pause()
            time.sleep(1080)
            breakcount += 1
    # exercise program
    if breakcount1 &lt; totalbreaks1:
        pygame.mixer.init()
        pygame.mixer.music.load(&quot;physical.mp3.mp3&quot;)
        pygame.mixer.music.play(-1)
        query = input('Did you do physical exercise (type exdone if yes) ?:')
        if query == 'exdone':
            with open('water.txt', 'r+') as o2:
                o2.write(f'You drank water at {t} ')
            pygame.mixer.music.pause()
            time.sleep(2400)
            breakcount1 += 1
            health()


z = input('Do you want to start the program? (y=yes , n=no):')
if z == 'y':
    health()
elif z == 'n':
    print('ok')
else:
    print('type correct input')
Variable naming
Your variables should be named something more telling than breakcount , breakcount1 and breakcount2. I suggest breakcount_water (and _eyes , _physical) instead.
Simpler logic
Instead of two variables for each kind of break (6 total), you can do with just one variable for each, starting at the max, and subtract 1 for each break. Then, you're done when you reach zero.
That lets you do the same thing with half as many (3) variables to keep track of.
Don't repeat yourself
pygame.mixer.init()
pygame.mixer.music.load(&quot;water.mp3.mp3&quot;)
pygame.mixer.music.play(-1)

These three lines are identical each time you play music.
Create a function instead that takes the file name as input, and you can call play_music(&quot;water.mp3.mp3&quot;) which then executes these three lines in the function.
def play_music(filename):
    #the three lines from above

Stack abuse
You're calling the health() function from inside itself, which means you never let it exit properly and if you did this a few thousand (maybe more) times, the program would crash due to stack overflow.
Instead, you should use a while loop that checks for the condition to loop again, to start over without calling the function another time. That way, you can also initialise your variables at the start of the function (before the while-loop) and you don't need any global variables, since the function has access to them inside its own scope.