I'm guessing you've worked with C or one of its relatives, where the entry point of a program is a call to main. That's not how it is in Python. Python works like many scripting languages, running the file from top to bottom, and your file contains one task for it to do: define a function named main. The tradition in scripts with such a function is to put a test at the bottom to call it, allowing a choice between importing the code and running it as a program:
if __name__ == '__main__':
main()
With this little epilogue, your program should actually run the main function.
There are a couple of other C-isms in your program as well. Python doesn't need parenthesis in while or if tests, and we have a more convenient for that operates using iterators instead of integers. For when integers are needed, range is convenient:
for x in range(5):
print(x)
If you're running Python 2, print is a statement that doesn't need parenthesis, but it is a function in Python 3 so I kept them.