How many halvings? · كم عدد القسومات؟
How many halvings?
n starts at 40. Halve it with n = n // 2 until it reaches 0, counting the steps in steps.
// divides and throws the remainder away, so 5 // 2 is 2. Counting how many times a loop went round needs its own variable, going up by one each turn.
كم عدد القسومات؟
يبدأ n عند 40. قسّمه بـ n = n // 2 حتى يصل إلى 0، عِدّ الخطوات في steps.
يقسم // ويتخلص من الباقي، لذا 5 // 2 هي 2. عدّ كم مرة دارت الحلقة يتطلب متغيراً خاصاً، يزيد بمقدار واحد في كل دورة.
n starts at 40. Halve it with n = n // 2 until it reaches 0, counting the steps in steps. · يبدأ n عند 40. قسّمه بـ n = n // 2 حتى يصل إلى 0، عِدّ الخطوات في steps.
Click Run to see the output here. · اضغط تشغيل لرؤية المخرجات هنا.