1
I would like the program to perform the repetition of a command 3 times: wait 10 seconds to open a web page. For this repetition to occur I set the code below:
import time
import webbrowser
total_breaks = 3
break_count = 0
while(break_count < total_breaks):
time.sleep(10)
webbrowser.open("https://www.youtube.com/watch?v=zywDiFdxopU")
webbrowser.open("https://www.youtube.com/watch?v=QwOU3bnuU0k")
webbrowser.open("https://www.youtube.com/watch?v=b2WzocbSd2w")
break_count = break_count + 1
But it turns out the pages open at the same time. I would like the first time he opens page a and the second time he opens page b and the third time he opens page c. How do I so that instead of the program opening all the web pages, he opens a page every time the program runs?
Pablo, I tried to run this way, but a syntax error appears. Yours ran smoothly?
– Alineat
I am without access to a Python interpreter now, but the change I made should not have been a mistake. What is the message and on which line is?
– Pablo Almeida
I think now it will. Try again there.
– Pablo Almeida
The message is: "Traceback (Most recent call last): File "python", line 6 for (endereco in enderecos): Syntaxerror: invalid syntax". It points specifically to the two points.
– Alineat
It had parentheses where it shouldn’t. Try again without them.
– Pablo Almeida