Above average · فوق المتوسط
Above average
Two loops, one after the other: the first works out the average, the second keeps the numbers above it.
This joins two patterns you have already used, the running total and the filter. Solving a problem in stages like this is how most longer programs are built.
أعلى من المتوسط
حلقتان، إحداهما بعد الأخرى: الأولى تحسب المتوسط، والثانية تحتفظ بالأرقام الأعلى منه.
هذا يجمع بين نمطين استخدمتهما بالفعل، المجموع التراكمي والفلتر. حل مشكلة على مراحل كهذه هو كيف تُبنى معظم البرامج الطويلة.
Write above_average(nums) that returns a list of the numbers greater than the average of nums, in their original order. The list is never empty. · اكتب above_average(nums) ترجع قائمة بالأرقام الأكبر من متوسط nums، بنفس ترتيبها الأصلي. القائمة لن تكون فارغة أبدًا.
Click Run to see the output here. · اضغط تشغيل لرؤية المخرجات هنا.