I started programming with Java and C++, so I'm used to having a 'main' function that calls other functions that do the actual work. At university I was always told that doing actual computation in the main function is bad practice. I'm currently playing around with Python, and I have trouble figuring out how to write a nice 'main' function, especially since I'm doing small stuff that doesn't need separate classes.
What do you think about the following code? Is the main function necessary, or would you just write everything without functions? Is there a general consent on this in the Python world?
# Finds sum of all multiples of 3 and 5 from 0 to 999 def find_multiples(): global numbers for i in range(0,1000): if i%3==0 or i%5==0: numbers.append(i); numbers = [] if __name__ == '__main__': find_multiples() print sum(numbers)