You should indent your main function with spaces or tabs. (4 spaces is recommanded)
Like this:
def main()
num=input()
# rest of your main code
main()
I saw you already did this for if/else, you should also do it for functions.
I recommend you take a beginner python course like the one of codecademy.
solved Indentation error basic program [closed]