Why time.sleep Isn't Working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why time.sleep Isn't Working?

#Made By Charles #Instruction: Just Put Two Parameters Into Two Seperate Lines And It Will Add. import time def sum(x, y): return x + y p1 = float(input("First Parameter: \n")) print(p1, "\n") p2 = float(input("Second Parameter: \n")) print(p2, "\n") print("Calculating...") time.sleep(1) i = 3 for chr in "...": print(chr * i) time.sleep(.5) i -= 1 for chr in "...": i += 1 print(chr * i) time.sleep(.5) print("\n" + str(sum(p1, p2)))

1st Sep 2018, 1:48 PM
Charles Darwin
Charles Darwin - avatar
3 Answers
+ 8
The coding playground here at SL executes your entire code and only provides output once execution has ended. So you don't perceive the effect of `time.sleep`. Your code should be working fine on any IDE. Also, I see you have the code in your profile. You can insert it here by pressing "+ Insert..." instead of copying and pasting. 😉 Happy coding!
1st Sep 2018, 2:04 PM
Eduardo Petry
Eduardo Petry - avatar
+ 4
Please use Pydroid 3 because SL playground gives you complete output the reason behind it your code is interpret or compile in SL server.server calculate the output and gives you which is complete output not in single steps that which you want.SL playground is just bridge between real ide which is set up on sololearn server and your code.
1st Sep 2018, 4:18 PM
Maninder $ingh
Maninder $ingh - avatar
+ 3
Works perfectly in IDE of my cell
1st Sep 2018, 6:00 PM
Luiz Santos
Luiz Santos - avatar