def fact(x):
  #variable "count" needs to be declared global, so we 
  #can access it inside and outside the function
  global count
  #increment by 1 each time we run the function
  count=count+1
  if x==1:
    return 1
  else:
    return x*fact(x-1)
#initialize the count to zero
count=0
print(fact(3))
print('function fact() was called',count,'times')

