社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  python开源

显示名字错误,请大神看看哪的问题?

dayday007 • 7 年前 • 683 次点击  

class Survey(): """收集调查问卷的答案""" def init(self,question): """存储一个问题,并为存储答案做准备""" self.question = question self.responses = [] def show_question(self): """显示调查问卷""" print(question) def store_question(self,new_response): """存储单份调查答案""" self.responses.append(new_response) def show_result(self): """显示收集到的所有答案""" print("Suevey result:") for response in responses: print("-"+response)

question = "what do you like?"
my_sur =Survey(question) my_sur.show_question() print("enter 'q' at any time to quit") while True: response=input("you like:") if response == 'q': break my_sur.store_question(response) print("\nthank you very much !" my_sur.show_result()

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/9418
 
683 次点击