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

جواب «Step 2: Gather the Text» چالش 2 از جلسه‌ی 72

سؤال

دیکشنریِ profile پروفایلِ ساختگیِ خودت است. همه‌ی متنِ عمومی (بیو و پست‌ها) را به یک رشته به اسمِ text بچسبان (با فاصله) و اول تعدادِ کلمه‌هایش را به شکلِ words: 27 و بعد خودِ text را چاپ کن.

راهنما

text = profile["bio"] + " " + " ".join(profile["posts"]) و تعداد با len(text.split()).

یک جواب درست

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 at the pool"],
}
text = profile["bio"] + " " + " ".join(profile["posts"])
print("words:", len(text.split()))
print(text)

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