# This program demonstrates a function with a side effect. # Each time f is called, the variable x's value changes. x = 5 def f(n): global x x = x * 2 return x + n def main(): global x x = 5 result = f(x) + f(x) print("result is", result) print("x is", x) main()