How to call from function to another function
Question: I am making a minesweeper game within python with pygame.

    
    
    import pygame, math, sys
    
    def bomb_check():
        if check in BOMBS:
        print("You hit a bomb!")
        sys.exit
    
    def handle_mouse(mousepos):
        x, y = mousepos
        x, y = math.ceil(x / 40), math.ceil(y / 40)
        check = print("("+"{0}, {1}".format(x,y)+")")
    

I want to call "check" to "bomb_check" Any other solution to this problem is
welcome, I am but a rookie at python.


Answer: Just use it as an argument:

    
    
    import pygame, math, sys
    
    def bomb_check(check):
        if check in BOMBS:
        print("You hit a bomb!")
        sys.exit
    
    def handle_mouse(mousepos):
        x, y = mousepos
        x, y = math.ceil(x / 40), math.ceil(y / 40)
        check = x, y
        print(check)
        bomb_check(check)
    

That will work only if you are storing a tuples of 2 items (integers) in your
BOMBS. Of course it also requires BOMBS to be in global scope.

