Difference between "t=int(input();for i in range(t)" and "for i in range(int(input())" ?

Revision en2, by tanu38, 2020-06-12 21:41:24

Hello everyone!

Recently while solving a question 313B (in Python3 ), Me and my friend observed that TLE comes when we directly iterate using input, but not when we store intput in a variable and then iterate.

Please explain the reason why this is happening! Refer: /predownloaded/32/31/323140108c2b30a1f3a6f7f2a7a3949cd82bb547.png /predownloaded/32/31/323140108c2b30a1f3a6f7f2a7a3949cd82bb547.png

Tags #python3, #tle

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English tanu38 2020-06-12 21:45:00 489
en2 English tanu38 2020-06-12 21:41:24 140
en1 English tanu38 2020-06-12 21:38:11 354 Initial revision (published)