Build a mathematical model in Python to calculate the probability of heads on a coin toss.
def probability_of_heads(n):
    total_outcomes = 2**n
    heads_outcomes = total_outcomes/2
    
    probability_of_heads = heads_outcomes / total_outcomes
    
    return probability_of_heads