New course! Every coder should learn Generative AI!
Try a free lesson+ 3
That's because of the time.sleep() function you have there.
Code written in code playground runs on sololearn's servers instead of your device and thus have a limmited time for execution (generally 3-4 sec) you are wasting that time using sleep function, just remove it to see the difference.