#
# We copy and paste the previous code
#

# initial case
# We assume that the probability of getting head is 1 at the beginning,
#    becasue Asja will start with one euro.
prob_head = 1
prob_tail = 0

number_of_iteration = 10

for i in range(number_of_iteration):
    # if the last result was head
    new_prob_head_from_head = prob_head * 0.6
    new_prob_tail_from_head = prob_head * 0.4

    # if the last result was tail
    # we know that prob_tail is 0 at the begining 
    #     but we still keep these two lines to have the same code for each iteration
    new_prob_head_from_tail = prob_tail * 0.3
    new_prob_tail_from_tail = prob_tail * 0.7

    # update the probabilities at the end of coin toss
    prob_head = new_prob_head_from_head + new_prob_head_from_tail
    prob_tail = new_prob_tail_from_head + new_prob_tail_from_tail
    
# print prob_head and prob_tail
print("the probability of getting head",prob_head)
print("the probability of getting tail",prob_tail)