def head_tails(p, n):
probability = p ** n
return probability
# Test the function
p = 0.5 # Probability of landing heads up
n = 3 # Number of heads in a row
result = head_tails(p, n)
print(f"The probability of getting {n} heads in a row is: {result}")