list_match= {"Mada":["yellow","green",],"Alexa":["blonde","brown"],"Sasha":["blue","readhead"],"Andreea":["cameleonic","brunett"]}
print ('welcome to the "Find your match quiz"')
print ("Let/'s begain")
eyes = input ("How should the eyes be?")
hair=input("How do you want the the hair to be?")
def cf(response,cond1,cond2,cond3,cond4):
if response == (cond1):
return response
if response == (cond2):
return response
if response == (cond3):
return response
if response ==(cond4):
return response
else:
return ("We don't have knowledge of this characteristic.")
cf(eyes,"green","brown","blue","cameleonic")
cf(hair,"yellow","blonde","readhead","brunett")
だから私は少し "Find your match"プログラムを作りたいと思っています。私は、女の子が持っているさまざまな特性に使うことができる機能を作ることに決めました... "ブロンド"青 "の目など... まあ...問題は、私は関数の結合結果を探す方法を知らないということです:cf(応答、con1、cond2、cond3、cond4)、私はしたいエンド印刷では、リストを含むディクショナリで値の組み合わせを探すにはどうすればよいですか?
cf(eyes,"green","brown","blue","cameleonic")
cf(hair,"yellow","blonde","readhead","brunett")
ので、私はその辞書にある各真の組み合わせのキーを取得するために、上記辞書で結果間の組み合わせを探すことができます:関数のこの二つの結果を結合します女の子の名前と「あなたが見つけた」文字列...
あなたの応答は私に別の質問をさせてくれます。演算子?私はここから議論の順序が重要であることを知っている、私はちょうど "cameleonic"と "brunett"がその辞書にあるかどうかを知りたい、順序は私には関係ありません... –
更新された答えを参照してください – rassar