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

Step 4: The Audit Report چالش 4 از جلسه‌ی 72، سخت

بازبینِ کامل: برای هر پستِ profile["posts"] و خودِ profile["bio"] بررسی کن کدام دسته‌های RISKY در آن نشانه دارند. برای هر متن یک خط چاپ کن: bio -> identity, location, security answers یا، اگر هیچ نشانه‌ای نداشت، post 3 -> clean. در پایان امتیازِ خطر را چاپ کن: risk score: 5 (تعدادِ کلِ جفت‌های متن/دسته که نشانه داشتند) و بعد توصیه: اگر امتیاز ۴ یا بیشتر بود advice: clean up the bio and delete risky posts وگرنه advice: looking good, re-check in 3 months.

profile = {
    "bio": "Sara, 16, Tehran. Student at Example High School. Love my cat Pishi!",
    "posts": ["My birthday is 14 March!", "New phone, call me: 0912xxxxxxx", "Best day ever with friends"],
}
RISKY = {
    "identity": ["birthday", "16", "Tehran"],
    "location": ["School", "pool", "home"],
    "contact": ["call me", "0912", "@"],
    "security answers": ["cat", "first car", "grandma"],
}

راهنما و جواب این چالش · برگشت به درس جلسه‌ی 72: پروژه: ردپای دیجیتالِ من · چالش بعدی: Leak Finder

بیشتر بخوان: list comprehension در پایتون: از حلقه for تا یک خط کد