continue reading lines until there is no more input python

//For HackerRank and HackerEarth platform below implementation is preferred:
while True:
try :
    line = input()
except EOFError:

Here is what the above code is Doing:
1. The while loop will keep running until it encounters an EOFError.
2. The try block will try to read the next line of input.
3. If the input is valid, the code in the try block will be executed.
4. If the input is not valid, the except block will be executed.
5. The except block will break out of the while loop.