• + 2 comments

    while(1) would still run indefinetely. But, to catch, end of inputs, there should be:

    except EOFError:
             break