0

What is the solution to the "Time limit exceeded" error in Code Playground?

I am trying a code to reverse an input number and everytime I run it, the " Time limit exceeded" error comes up. The code is rather basic and only works with loops and simple math operations. Loops are closed correctly and I don't get any syntax errors as well. Can anyone help me sort this out? https://code.sololearn.com/cynO6wA8bow7/?ref=app Edit: Issue solved! An error from my side!

18th Mar 2019, 11:13 AM
Shubham Gune
Shubham Gune - avatar
2 Answers
+ 3
You have coded an infinity loop in line 4. n is not altered, it stays always the same and thus n//10 > 0 will always be fulfilled for at least two digit numbers 😉
18th Mar 2019, 11:21 AM
Matthias
Matthias - avatar
+ 1
I feel so dumb! Just had to replace the 10 with " i ". The 10 was from when I was trying to work the code for two digits! Now it works perfect! Thanks!
18th Mar 2019, 11:29 AM
Shubham Gune
Shubham Gune - avatar