Edit a given Python program to make it bug-free.
def foo():
   i = 0
   for x in range(10):
      i = i + x
      
   print(i)

foo()
def foo():
   i = 0
   for x in range(10):
      i = i + x
   return i

print(foo())