monikturing / turing-data-challenge

Turing Data Challenge
0 stars 1 forks source link

More details about processing for loops. #1

Open rahulov opened 5 years ago

rahulov commented 5 years ago

https://docs.google.com/document/d/1P9k1JcZ8RnXV9ylqlt7yhWBP1hueReX0oHHvhSCYCPs/edit

for example: What is expected depth of for loops here?

for z in range(5):
   t += sum(i*j for i in range(5) for j in range(5))

What about for in functions defined scope.

for i in range(x):
    def fun():
        for j in range(5):
           return 4 # haha
        return

Does async for counts? Accoring to PEP0492 it is converted in while loop.

monikturing commented 5 years ago

The expected depth is 2 in the first case.

Since we're doing semantic analysis of the code and not runtime analysis, the expected depth will be 2.

Note that we're accepting answers with an error percentage of 5% so you may make certain assumptions about the special cases and it is unlikely that it will push your answer outside of the range.