+ 4

Python

How long can you run this code: even = [2*i for i in range(10000)] print(even) My record is 2914 :) Is it about internet connection or the mobile phone?

29th May 2019, 1:24 PM
Leon KV
3 odpowiedzi
+ 4
Use yield function and you can run for infinite time(will never stop)
29th May 2019, 1:32 PM
Pulkit Kamboj
Pulkit Kamboj - avatar
+ 4
Well my record is 1548. After that it is showing Time limit exceeded. Nobody will be able to run this whole code in the sololearn playground in mobile . It will show time limit exceeded as it has to print a large no. Of digits i.e. 10000 But if you run this in computer or in any other application such as pyroid 3 or Qpython. There it will run the whole code. Thanks
29th May 2019, 1:37 PM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 4
With some minor modifications, I got to 19,998 https://code.sololearn.com/cpYWfYs6smSQ/?ref=app
29th May 2019, 5:55 PM
Anna
Anna - avatar