# Scope 2 def f1(): x = 2 x = x + 3 return x print x y = f1() print x print y # Why variables are locally scoped def corrupt_string(my_string): my_string = "Corrupted String" return my_string # Since my_string is immutable, we know it cannot be modified # Since variables are locally scoped, we know it cannot be redefined inside a function my_string = "My Important String" corrupt_string(my_string) print my_string # Therefore my_string is not corrupted