需要帮助我的其他声明不会打印

时间:2018-01-18 00:51:07

标签: python-3.x

我写了这段非常基本的代码。当我运行它时,else语句不起作用。三个if语句获得正确的网页并打印报表就好了。

import webbrowser
import time

breaks = 3
breaks_taken = 0

if(breaks_taken == 0):
    breaks_taken = breaks_taken + 1
    time.sleep(5)
    webbrowser.open('https://www.youtube.com/watch?v=R03cqGg40GU')
    print('this program was started at ' + time.ctime())
if(breaks_taken == 1):
    breaks_taken = breaks_taken + 1
    time.sleep(5)
    webbrowser.open('https://www.youtube.com/watch?v=AfuCLp8VEng')
    print('this program was started at ' + time.ctime())
if(breaks_taken == 2):
    breaks_taken = breaks_taken + 1
    time.sleep(5)
    webbrowser.open('https://www.youtube.com/watch?v=-MsvER1dpjM')
    print('this program was started at ' +time.ctime())
else:
    print('this is your final break')

0 个答案:

没有答案