from random import randint
person = ["My friend", "My sister", "Joe mama", "Barack Obama"]
speech = ["said", "shouted", "whispered"]
personSecond = ["he", "she"]
expression = ["likes", "hates", "always thinks about"]
ing = ["playing computer games", "dominating the world"]
w = randint(0,3)
x = randint(0,2)
y = randint(0,2)
z = randint(0,3)
print(person[w], speech[x], end = " ")
if w == '0' or w == '3':
print(personSecond[0], end = " ")
elif w == '1' or w == '2':
print(personSecond[1], end = " ")
print(expression[y], ing[z])
我只得到人、语言、表情和声音的输出。Python不打印personSecond列表中的字符串
我做错了什么
你不能把数字和字符串作比较
w
是一个数字'0'
是一个字符串或者
或者
相关问题 更多 >
编程相关推荐