Skip to content · ⁨الانتقال إلى المحتوى⁩

Letter frequencies · ⁨ترددات الأحرف⁩

English

Letter frequencies

Return a dictionary that tells you how many times each character appears in a string. For "aab" that is {"a": 2, "b": 1}.

The handy move is freq.get(ch, 0) — it reads the current count for ch, or 0 if you haven't seen it yet. Add 1 and store it back.

العربية

تكرار الحروف

أعد قاموساً يخبرك بعد مرات ظهور كل حرف في السلسلة النصية. بالنسبة لـ "aab"، يكون الناتج {"a": 2, "b": 1}.

الخطوة العملية هي freq.get(ch, 0) — حيث تقرأ العداد الحالي لـ ch، أو 0 إذا لم تره من قبل. أضف 1 واحفظ النتيجة مجدداً.

Log in or create account · ⁨تسجيل الدخول أو إنشاء حساب⁩

IGCSE, A-Level & AP