0
Error
why there's error on while loop ? https://code.sololearn.com/cUIppsoR8WRx/?ref=app
1 Respuesta
0
Here are some of the reasons.
-> 'While' should be 'while'
-> line 11: 'sleep' should be 'time.sleep'
-> There was a ')' missing at the end of line 10
-> Your identation was wrong
-> index = 0 should be inside the function
-> 'import randint' should be 'import random'
-----------------
I've fixed these and other problems in the code below.
import webbrowser, time, random
sites=["www.rwaq.org","www.facebook.com","www.google.com.eg","www.youtube.com","www.twitter.com","www.ask.fm","www.instagram.com"]
def breaktime ():
index = 0
while index <= 8 :
webbrowser.open(random.choice(sites))
print("Take a rest")
time.sleep (10)
index +=1
breaktime()