- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我试图制作一个包含所有这些问题的文件,但没有成功!
question = open(filename.txt "r")
这是我所做的:
#!/usr/bin/python
# questions.py
questions1 = [("At a party do you", "interact with many, including strangers", "interact with a few, known to you"),
("At parties do you", "Stay late, with increasing energy", "Leave early, with decreasing energy"),
("In your social groups do you", "Keep abreast of others happenings", "Get behind on the news"),
("Are you usually rather", "Quick to agree to a time", "Reluctant to agree to a time"),
("In company do you", "Start conversations", "Wait to be approached"),
("Does new interaction with others", "Stimulate and energize you", "Tax your reserves"),
("Do you prefer", "Many friends with brief contact", "A few friends with longer contact"),
("Do you", "Speak easily and at length with strangers", "Find little to say to strangers"),
("When the phone rings do you", "Quickly get to it first", "Hope someone else will answer"),
("At networking functions you are", "Easy to approach", "A little reserved")]
counter_a, counter_b = 0, 0
for question in questions1:
question_string = "%s:\n\tA. %s\n\tB. %s\n[a/b]: " % (question[0], question[1], question[2])
answer = raw_input(question_string).lower()
while answer not in ("a", "b"):
print("Please choose A or B")
answer = raw_input(question_string).lower()
if answer == "a":
counter_a += 1
else:
counter_b += 1
#print "A total is %d" % counter_a
#print "B total is %d" % counter_b
if counter_a > counter_b:
print 'Your first personality code is: E'
else:
print 'Your first personality code is: I'
##############################################################################
questions2 = [("Are you more", "Realistic", "Philosophically inclined "),
("Are you a more", "Sensible person", "Reflective person "),
("Are you usually more interested in", "Specifics", "Concepts "),
("Facts", "Speak for themselves", "Usually require interpretation "),
("Traditional common sense is", "Usually trustworthy", "often misleading "),
("Are you more frequently", "A practical sort of person", "An abstract sort of person "),
("Are you more drawn to", "Substantial information", "Credible assumptions "),
("Are you usually more interested in the", "Particular instance", "General case "),
("Do you prize more in yourself a", "Good sense of reality", "Good imagination "),
("Do you have more fun with", "Hands-on experience", "Blue-sky fantasy "),]
counter2_a, counter2_b = 0, 0
for question in questions2:
question_string = "%s:\n\tA. %s\n\tB. %s\n[a/b]: " % (question[0], question[1], question[2])
answer = raw_input(question_string).lower()
while answer not in ("a", "b"):
print("Please choose A or B")
answer = raw_input(question_string).lower()
if answer == "a":
counter2_a += 1
else:
counter2_b += 1
#print "A total is %d" % counter2_a
#print "B total is %d" % counter2_b
##############################################################################
questions3 = [("Are you usually more", "Fair minded", "Kind hearted"),
("Is it more natural to be", "Fair to others", "Nice to others"),
("Are you more naturally", "Impartial", "Compassionate"),
("Are you inclined to be more", "Cool headed", "Warm hearted"),
("Are you usually more", "Tough minded", "Tender hearted"),
("Which is more satisfying", "To discuss an issue throughly", "To arrive at agreement on an issue"),
("Are you more comfortable when you are", "Objective", "Personal"),
("Are you typically more a person of", "Clear reason", "Strong feeling"),
("In judging are you usually more", "Neutral", "Charitable"),
("Are you usually more", "Unbiased", "compassionate")]
counter3_a, counter3_b = 0, 0
for question in questions3:
question_string = "%s:\n\tA. %s\n\tB. %s\n[a/b]: " % (question[0], question[1], question[2])
answer = raw_input(question_string).lower()
while answer not in ("a", "b"):
print("Please choose A or B")
answer = raw_input(question_string).lower()
if answer == "a":
counter3_a += 1
else:
counter3_b += 1
plus1a3 = counter3_a + counter2_a
plus2b3 = counter3_b + counter2_b
#print "A total is %d" % plus1a3
#print "B total is %d" % plus2b3
if plus1a3 > plus2b3:
print 'Your second personality code is: S'
else:
print 'Your second personality code is: N'
##############################################################################
questions4 = [("Do you tend to be more", "Dispassionate", "Sympathetic"),
("In first approaching others are you more", "Impersonal and detached", "Personal and engaging"),
("In judging are you more likely to be", "Impersonal", "Sentimental"),
("Would you rather be", "More just than merciful", "More merciful than just"),
("Are you usually more", "Tough minded", "Tender hearted"),
("Which rules you more", "Your head", "Your heart"),
("Do you value in yourself more that you are", "Unwavering", "Devoted"),
("Are you inclined more to be", "Fair-minded", "Sympathetic"),
("Are you convinced by?", "Evidence", "Someone you trust"),
("Are you typically more", "Just than lenient", "Lenient than just")]
counter4_a, counter4_b = 0, 0
for question in questions4:
question_string = "%s:\n\tA. %s\n\tB. %s\n[a/b]: " % (question[0], question[1], question[2])
answer = raw_input(question_string).lower()
while answer not in ("a", "b"):
print("Please choose A or B")
answer = raw_input(question_string).lower()
if answer == "a":
counter4_a += 1
else:
counter4_b += 1
plus1a4 = counter4_a + counter3_a
plus2b4 = counter4_b + counter3_b
#print "A total is %d" % plus1a4
#print "B total is %d" % plus2b4
##############################################################################
questions5 = [("Do you prefer to work", "To deadlines", "Just whenever"),
("Are you usually more", "Punctual", "Leisurely"),
("Do you usually", "Settle things", "Keep options open"),
("Are you more comfortable", "Setting a schedule", "Putting things off"),
("Are you more prone to keep things", "well organized", "Open-ended"),
("Are you more comfortable with work", "Contracted", "Done on a casual basis"),
("Are you more comfortable with", "Final statements", "Tentative statements"),
("Is it preferable mostly to", "Make sure things are arranged", "Just let things happen"),
("Do you prefer?", "Getting something done", "Having the option to go back"),
("Is it more like you to", "Make snap judgements", "Delay making judgements")]
counter5_a, counter5_b = 0, 0
for question in questions5:
question_string = "%s:\n\tA. %s\n\tB. %s\n[a/b]: " % (question[0], question[1], question[2])
answer = raw_input(question_string).lower()
while answer not in ("a", "b"):
print("Please choose A or B")
answer = raw_input(question_string).lower()
if answer == "a":
counter5_a += 1
else:
counter5_b += 1
plus1a5 = counter5_a + counter4_a
plus2b5 = counter5_b + counter4_b
#print "A total is %d" % plus1a5
#print "B total is %d" % plus2b5
if plus1a5 > plus2b5:
print 'Your third personality code is: T'
else:
print 'Your third personality code is: F'
##############################################################################
questions6 = [("Do you tend to choose", "Rather carefully", "Somewhat impulsively"),
("Does it bother you more having things", "Incomplete", "Completed"),
("Are you usually rather", "Quick to agree to a time", "Reluctant to agree to a time"),
("Are you more comfortable with", "Written agreements", "Handshake agreements"),
("Do you put more value on the", "Definite", "Variable"),
("Do you prefer things to be", "Neat and orderly", "Optional"),
("Are you more comfortable", "After a decision", "Before a decision"),
("Is it your way more to", "Get things settled", "Put off settlement"),
("Do you prefer to?", "Set things up perfectly", "Allow things to come together"),
("Do you tend to be more", "Deliberate than spontaneous", "Spontaneous than deliberate")]
counter6_a, counter6_b = 0, 0
for question in questions6:
question_string = "%s:\n\tA. %s\n\tB. %s\n[a/b]: " % (question[0], question[1], question[2])
answer = raw_input(question_string).lower()
while answer not in ("a", "b"):
print("Please choose A or B")
answer = raw_input(question_string).lower()
if answer == "a":
counter6_a += 1
else:
counter6_b += 1
plus1a6 = counter6_a + counter5_a
plus2b6 = counter6_b + counter5_b
#print "A total is %d" % plus1a6
#print "B total is %d" % plus2b6
if plus1a6 > plus2b6:
print 'Your fourth personality code is: J'
else:
print 'Your fourth personality code is: P'
####################################################################
我是编程方面的新手,如果我的问题含糊不清,请提前致歉!
缺少我想做的,我想根据 Myers-Briggs 类型指标进行性格测试
我要问- 设置大约 70 个带有 A 或 B 选项的问题- 我想让这尽可能简单
我粘贴了开始时使用的代码。 - 我知道我离题太远了
预先感谢您的帮助!
counterA = 0
counterB = 0
question = raw_input('At a party do you? \n A. Interact with many, includingstrangers \n B. Interact with a few, known to you. \n ')
print ''
question = raw_input('At a party do you? \n A. Interact with many, includingstrangers \n B. Interact with a few, known to you. \n ')
def question_x(x):
raw_input('')
question_x('')
def answer(x):
if question == 'a' or question == 'A':
counterB = counterB + 1
else:
counterB = counterB + 1
print counterA
print counterB
#if q1 == 'a' or q1 == 'A':
# counterA = counterA + 1
#else:
# counterB = counterB + 1
##############################################
#if q2 == 'a' or q2 == 'A':
# counterA = counterA + 1
#else:
# counterB = counterB + 1
#print counterA
#print counterB
最佳答案
这是一个非常普遍的问题。所以我给出了一些基本的想法:
question[i]
、optionA[i]
和 optionB[i]
。关于python - 想在 python 中创建性格测试。如何为这个任务做函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10448143/
Task.WaitAll 方法等待所有任务,Task.WaitAny 方法等待一个任务。如何等待任意N个任务? 用例:下载搜索结果页面,每个结果都需要一个单独的任务来下载和处理。如果我使用 WaitA
我正在查看一些像这样的遗留 C# 代码: await Task.Run(() => { _logger.LogException(LogLevel.Error, mes
如何在 Linux 中运行 cron 任务? 关注此Q&A ,我有这个 cron 任务要运行 - 只是将一些信息写入 txt 文件, // /var/www/cron.php $myfile = fo
原谅我的新手问题,但我想按顺序执行三个任务并在剧本中使用两个角色: 任务 角色 任务 角色 任务 这是我到目前为止(任务,角色,任务): --- - name: Task Role Task ho
我有一个依赖于 installDist 的自定义任务 - 不仅用于执行,还依赖于 installDist 输出: project.task('run', type: JavaExec, depends
从使用 Wix 创建的 MSI 运行卸载时,我需要在尝试删除任何文件之前强行终止在后台运行的进程。主要应用程序由一个托盘图标组成,它反射(reflect)了 bg 进程监控本地 Windows 服务的
我想编写 Ant 任务来自动执行启动服务器的任务,然后使用我的应用程序的 URL 打开 Internet Explorer。 显然我必须执行 startServer先任务,然后 startApplic
使用 ASP.NET 4.5,我正在尝试使用新的 async/await 玩具。我有一个 IDataReader 实现类,它包装了一个特定于供应商的阅读器(如 SqlDatareader)。我有一个简
使用命令 gradle tasks可以得到一份所有可用任务的报告。有什么方法可以向此命令添加参数并按任务组过滤任务。 我想发出类似 gradle tasks group:Demo 的命令筛选所有任务并
除了sshexec,还有什么办法吗?任务要做到这一点?我知道您可以使用 scp 复制文件任务。但是,我需要执行其他操作,例如检查是否存在某些文件夹,然后将其删除。我想使用类似 condition 的东
假设我有字符串 - "D:\ApEx_Schema\Functions\new.sql@@\main\ONEVIEW_Integration\3" 我需要将以下内容提取到 diff 变量中 - 文档名
我需要编写一个 ant 任务来确定某个文件是否是只读的,如果是,则失败。我想避免使用自定义选择器来为我们的构建系统的性质做这件事。任何人都有任何想法如何去做?我正在使用 ant 1.8 + ant-c
这是一个相当普遍的计算机科学问题,并不特定于任何操作系统或框架。 因此,我对与在线程池上切换任务相关的开销感到有些困惑。在许多情况下,给每个作业分配自己的特定线程是没有意义的(我们不想创建太多硬件线程
我正在使用以下 Ansible playbook 一次性关闭远程 Ubuntu 主机列表: - hosts: my_hosts become: yes remote_user: my_user
如何更改 Ant 中的当前工作目录? Ant documentation没有 任务,在我看来,最好的做法是不要更改当前工作目录。 但让我们假设我们仍然想这样做——你会如何做到这一点?谢谢! 最佳答案
是否可以运行 cronjob每三天一次?或者也许每月 10 次。 最佳答案 每三天运行一次 - 或更短时间在月底运行一次。 (如果上个月有 31 天,它将连续运行 2 天。) 0 0 */3 * *
如何在 Gradle 任务中执行托管在存储库中的工具? 在我的具体情况下,我正在使用 Gradle 构建一个 Android 应用程序。我添加了一项任务,将一些 protobuf 数据从文本编码为二进
我的项目有下一个结构: Root |- A |- C (depends on A) \- B (depends on A) 对于所有子项目,我们使用自己的插件生成资源:https://githu
我设置了一个具有4个节点的Hadoop群集,其中一个充当HDFS的NameNode以及Yarn主节点。该节点也是最强大的。 现在,我分发了2个文本文件,一个在node01(名称节点)上,一个在node
在 TFS 2010 中为多个用户存储任务的最佳方式是什么?我只能为一项任务分配一个。 (例如:当我计划向所有开发人员演示时) (这是一个 Scrum Msf 敏捷项目,其中任务是用户故事的一部分)
我是一名优秀的程序员,十分优秀!