You have to call main() after you declare it (see last line):
#definition of function main def main(): x = 0 while (x < 5): print(x) x = x + 1 #When the program is called, all the commands get executed (including the ones below) main()