我运行程序但是当单词等于50,000时,循环不会停止。产量有时超过50,000。我不确定我做错了什么。
words = 0
unwanted_comments = 0
comments = 0
keep_going = True
while number_of_comments <= max_comments and keep_going == True:
num_per_comments = random.randint(1,1050)
if number_per_comments <= 1000:
words = number_per_comments + total
comments +=1
if words <= 50000:
keep_going = True
else:
keep_going = False
else:
unwanted_comments +=1
答案 0 :(得分:-1)
你必须检查total_words是否<= 50000而不是单词&lt; = 500000,不是吗?!