Without functions all we have are attributes of objects. Functions are where variables live. This extract from Programmer's Python: Everything is an Object explains that functions bring something new ...
You can define a function anywhere in your code. When you first start with Python this generally means defining functions within a module, i.e. at the “top level”. However, there is nothing wrong with ...