示例#1
0
from survey import AnonymousSurvey

# 定义一个问题,并创建一个表示调查的AnonymousSurvey对象
question = "What language did you first learn to speak? "
my_survey = AnonymousSurvey(question)  # 向类传递变量

# 显示问题并存储答案
my_survey.show_question()  # 调用方法,显示问题
print("Enter 'q' at any time to quit.\n")

while True:
    response = input("Language: ")
    if response == 'q':
        break
    my_survey.store_response(response)  # 实例调用类方法,添加变量获取的信息;在while循环里获取所有数据

# 显示调查结果

print("\nThank you!")
my_survey.show_results()  # 实例.方法()
# CH11 Example
#
# language_survey.py
#
# Testing the class in survey.py

from survey import AnonymousSurvey

# Define a question and make a survey
question = "What language did you first learn to speak?"

my_question = AnonymousSurvey(question)

# Show the question and store the response to the question
my_question.show_question()
print("Enter 'q' at any time to quit. \n")

while True:
    response = input("Language: ")
    if response.lower() == 'q':
        break
    else:
        my_question.store_response(response)

# Show survey response
print("Thank you to everyone who participated in the survey! ")
my_question.show_results()
示例#3
0
from survey import AnonymousSurvey

question = "What language do you speak? "
new_survey = AnonymousSurvey(question)

new_survey.show_question()
print("Enter q at any time to quit. \n")

while True:
	response = input("Language: ")
	if response != 'q':
		new_survey.store_response(response)
	else:
		break
new_survey.show_results()
from survey import AnonymousSurvey

#Define a question and make a survey
question = "What language did you first learn to speak?"
language_survey_instance = AnonymousSurvey(question)

#Show question and store responses to the question
language_survey_instance.show_question()
print("Press q at any time to quit: ")
while True:
    specific_response = input("What was your first lanaguage? ")
    if specific_response == 'q':
        break
    language_survey_instance.store_question(specific_response)

#Show the survey results
print("\nThank you for taking the survey. Please see the results: ")
language_survey_instance.print_responses()
from survey import AnonymousSurvey
"""定义一个问题,并创建一个表示调查的AnonymousSurver对象"""
question = "What language did you first learn to sperk?"
my_surver = AnonymousSurvey(question)
# 显示问题并存储答案
my_surver.show_question()
print("Enter 'q' at any time to quit,\n")
while True:
    response = input("Language:")
    if response == 'q':
        break
    my_surver.store_response(response)

# 显示调查结果
print("\nThank you to everyone who participated in the surver!")
my_surver.show_results()
示例#6
0
from survey import AnonymousSurvey

# Define a question, and make a survey.
question = "What language did you first learn to speak?"
my_survey = AnonymousSurvey(question)

# Show the question, and store responses to the question.
my_survey.show_question(question)
print("Enter 'q' at any time to quit.\n")
while True:
	response = input("Language: ")
	if response == 'q':
		break
	my_survey.store_response(response)

# Show the survey results.
print("\nThank you to everyone who participated in the survey!")
my_survey.show_results()
from survey import AnonymousSurvey

QUIT_VALUE = 'q'

# Define a question, and make a survey.
question = "What language did you first learn to speak?"
survey = AnonymousSurvey(question)

# Show the question, and store responses to the question.
survey.show_question()
print(f"Enter '{QUIT_VALUE}' at any time to quit.\n")
while True:
    response = input("Language:")
    if response == QUIT_VALUE:
        break
    survey.store_response(response)

# Show the survey results.
print("\nThank you to everyone who participated in the survey!")
survey.show_results()
示例#8
0
from survey import AnonymousSurvey

question = "What language did you first learn to speak?"
my_servey = AnonymousSurvey(question)

my_servey.show_question()
print("Enter 'q' at any times to exit.\n")

while True:
    response = input("Language: ")
    if response == 'q':
        break
    my_servey.store_response(response)

print("\nThank you to everyone who participated in the survey!")
my_servey.show_results()
示例#9
0
from survey import AnonymousSurvey

question = 'What language did you first learn to speak?'
mySurvey = AnonymousSurvey(question)
mySurvey.show_question()
print("Enter 'q' at any time to quit.\n")
while True:
    response = input("Language: ")
    if response == 'q':
        break
    mySurvey.save_response(response)

print("\n Thank you for your participation!\n")
mySurvey.show_results()

示例#10
0
from survey import AnonymousSurvey

# Define a Question and make a survey
question = "What is your favourite programming language?"
my_survey = AnonymousSurvey(question)

# Show the question and Store responses to the question
print(my_survey.show_question())
print("Enter q to quit")
while True:
    inp = input("Enter your response:")
    if inp == "q":
        break
    my_survey.store_response(inp)

# Show the survey results
print("\n Thankyou for your response in the Survey!!!!")
my_survey.show_results()
from survey import AnonymousSurvey

# create a survey
program_language_survey = AnonymousSurvey("What language do you work? ")

# store the response
program_language_survey.show_question()
print("Enter 'q' at any time to quit.")
while True:
    response = input("Language: ")
    if response == 'q':
        break
    program_language_survey.store_response(response)

# Show the survey results
print("Thank you to everyone who take part in the survey!")
program_language_survey.show_results()
示例#12
0
from survey import AnonymousSurvey

question = "What language did you first learn to speak?"
my_sruvey = AnonymousSurvey(question)

my_sruvey.show_question()
print("Enter 'q' at any time to quit.\n")
while True:
    response = input("Language:")
    if response == 'q':
        break
    my_sruvey.store_response(response)

print("\nThank you to everyone who participated in the survey!")
my_sruvey.show_results()
示例#13
0
"""
Defines a question ("What language did you first learn to speak?") and
creates and Anonymous survey object with that question
"""

from survey import AnonymousSurvey

# Define a question, and make a survey.
QUESTION = "What language did you first learn to speak?"
MY_SURVEY = AnonymousSurvey(QUESTION)

# Show the question, and store responses to the question.
MY_SURVEY.show_question()
print("Enter 'q' at any time to quit.\n")
while True:
    RESPONSE = input("Language: ")
    if RESPONSE == 'q':
        break
    MY_SURVEY.store_response(RESPONSE)
    # Show the survey results.
    print("\nThank you to everyone who participated in the survey!")
    MY_SURVEY.show_results()
示例#14
0
#language_survey.py

from survey import AnonymousSurvey

question = "What language did you first learn to speak?"
dab = AnonymousSurvey(question)

dab.show_question()
print("enter 'q' at any time to quit.\n")
while True:
    response = input("Language: ")
    if response == 'q':
        break
    dab.store_response(response)

print("\nThank you to everyone who participated in the survey!")
dab.show_results()
示例#15
0
from survey import AnonymousSurvey

#定义一个问题,并创建一个表示调查的AnonyymousSurvey对象
question = "What language did you first learn to speak?"

my_survey = AnonymousSurvey(question)

#显示问题并存储答案
my_survey.show_question();
print("Enter 'q' at any time to quit.\n")
while True:
    response = input("language:")
    if response == 'q':
        break
    my_survey.store_response(response)
#显示调查结果
print("\nThank you to everyone who participated in the survey!")
my_survey.show_results()
示例#16
0
from survey import AnonymousSurvey

# 定义一个问题,并创建一个表示调查的AnonymousSurvey对象
question = "What language did you first learn to speak?"
llr_survey = AnonymousSurvey(question)

# 显示问题并存储答案
llr_survey.show_question()
print("Enter 'q' at any time to quit.\n")
while True:
    r = input("Language:")
    if r == 'q':
        break
    else:
        llr_survey.store_response(r)

# 显示调查结果
llr_survey.show_results()


示例#17
0
from survey import AnonymousSurvey
# 定义一个问题, 并创建一个表示调查的AnonymousSurvey
question = "哪门语言是你第一门学会的语言"
my_survey = AnonymousSurvey(question)
# 显示问题并存储答案
my_survey.show_question()
print("Enter 'q' at any time to quit.\n")
while True:
    response = input("Language: ")
    if response == 'q':
        break
    my_survey.store_response(response)
# 显示调查结果
print("\n谢谢参加调查的每一位")
my_survey.show_results()
示例#18
0
from survey import AnonymousSurvey

#定义一个问题,并创建一个调查的AnonymousSurvey对象
question = "What language did you first learn to speak?"
my_survry = AnonymousSurvey(question)

#显示问题并存出答案
my_survry.show_question()
print("Enter 'q' at any time to quit.\n")

while True:
    response = input("Language: ")
    if response == 'q':
        break
    my_survry.store_response(response)

#显示调查结果
print("\nThank you to every who participated in the survey!")
my_survry.show_results()