بتل کد Battle Codeدارد باز می‌شود…

جواب «Compare with the Baseline» چالش 2 از جلسه‌ی 73

سؤال

دیکشنریِ BASELINE تنظیماتِ درست است و current تنظیماتِ فعلیِ حسابِ ساختگی. برای هر تنظیمی که با خطِ پایه فرق دارد، یک خط به شکلِ fix: messages_from -> following چاپ کن (به ترتیبِ BASELINE).

راهنما

for key, good in BASELINE.items(): و شرطِ current.get(key) != good.

یک جواب درست

BASELINE = {"private": True, "messages_from": "following", "location_tags": False, "contact_sync": False, "two_factor": True}
current = {"private": True, "messages_from": "everyone", "location_tags": True, "contact_sync": False, "two_factor": False}
for key, good in BASELINE.items():
    if current.get(key) != good:
        print("fix:", key, "->", good)

اول خودت امتحان کن؛ جواب‌های دیگر هم قبول است. برگرد و خودت حلش کن