0
What does 'execution timed out' means in Python how is it caused and how to avoid it?
lst = eval(input("enter elements ")) count = 0 for item in lst: num = item sum = 0 while item > 0: dg = item % 10 sum += dg**3 item //= item if sum == num: count += 1 print(count) This is the code that I've written it only takes the input and doesn't print anything while using an IDE while running it on sololearn shows an ' execution timed out ' can anybody tell me what's happening? Edit: o.gak thanks and sorry for the dumb mistake. Ipang thank you, I will try to be more relevant next time.
1 Answer
+ 4
You got an infinite loop, because of
'item //= item'.
'item' will always be 1 in your code.