I was trying a coding contest just now.
I was given N lines of inputs are integer, so take those inputs , I used the following code.
arr = [int(input()) for i in xrange(N)]
# where N is a given number of Inputs
Due to this piece of code, I was getting TLE ( TIME LIMIT EXCEEDED ) Error.
But when I change the input code to the following, my code gets accepted without TLE.
arr = []
for i in xrange(N):
arr.append(int(raw_input()))
#where N is the given number of inputs
Can some please explain, why is there are difference in execution time, though , to my understanding, both the forms of code necessarily do the same task and in the same manner.