How would you write this procedure?

--8<---------------cut here---------------start------------->8---
def powers_of_2_in(n):
  s = 0
  while "I still find factors of 2 in n...":
    q, r = divmod(n, 2)
    if r == 0:
      s = s + 1
      n = n // 2
    else:
      return s, n
--8<---------------cut here---------------end--------------->8---
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to