-1
我写这PROGRAMMPython的随机应答程序
#!/usr/bin/env python
"""
"""
import random
def CollectStrings():
string_list = []
while True:
string = raw_input("What is your question: (enter to quit): ")
if not string:
return string_list
string_list.append(string)
def ChooseStrings(how_many):
string_list = CollectStrings()
chosen = random.sample(string_list, how_many)
chosen.sort()
return ', '.join(chosen)
print ChooseStrings (3)
但我需要让这个程序随机回答的问题,比如一个很可能很可能。 我该怎么做?
你应该改一下你的问题具体的东西。 “你能为我写这个程序吗”并不具体。你对你的计划有什么了解?你认为这个问题在哪里?你有什么尝试? – 2012-02-09 09:36:57