私はゲームを作っています。このゲームでは、ユーザーに質問があります。彼がそれを正しく得るなら、それはright_answerリストに入って、答えリストに行きます。彼はそれが間違っている場合は、答えのリストに入る。プラス彼らは正しい正しい質問ごとにポイントを得る。その8つの質問になると、それぞれが関数です。これは質問番号1です。問題は何も印刷しないということです。関数外のリストにリストを返す方法
def question_one(answer,right_answer,points):
answer = []
right_answer = []
print "how would you write this question in code so it would print"
answer=raw_input("< ")
#this is if he gets it right
if answer=="""print "how would you write this question in code so it would
print""""":
#this is where the answers are inserted into the lists
right_answer.append(answer)
# this is where the answer goes that they gave
answer.append(answer)
points=points+1
#this is if he gets it wrong
else:
answer.append(answer)
#this is to return the values and the lists for the right answer and the
answer
return answer,right_answer,points
(answer.append(answers),correct_answer.append(correct_answers), points)=question_one(answers,correct_answers,points)
あなたは 'append'に割り当てることはできません。コール、またはその他の関数またはメソッド呼び出しを呼び出すことができます。 – user2357112
もう少し明確にすることはできますか?コードの最後の行に何をしようとしているのか混乱しています – Mangohero1
あなたの回答文字列は無効です。あなたは '' 'print 'をしたいでしょう。この質問をコードに書くと、\" "" '' '' print' "という印字ができます。 Pythonは4つの ''を一緒に誤って解釈するので、二重引用符を使用する場合は、最後のものをエスケープする必要があります。 – TemporalWolf