Avatar ·

The overkill of the key-value in 2 or more dictionaries and the recording of coincidence in the new dictionary through *args

📁 قاموس, بايثون, مساعدة, خطأ

هناك قاموسان، تحتاج إلى فرز المفتاح-القيمة في كلا القاموسين. قارن إذا كان نفس المفتاح-القيمة باستخدام حلقة FOR ومعامل *args. أضف نفس المفتاح-القيمة الذي تم العثور عليه إلى القاموس الجديد.

  operator_one = { 2 :  'break' ,   1 :  'pass' ,   3 :  'print' ,   4 :  'yield' ,   5 :  'try' , } operator = { 1 :  'pass' ,   2 :  'global' ,   3 :  'yield' ,   4 :  'print' ,   5 :  'try' , }   def