input: Write a Python function that computes the multiplication of all odd digits in a specified positive integer n, returning 0 if it contains only even digits.
  assert digits(5) == 5
  assert digits(54) == 5
  assert digits(120) == 1
  assert digits(5014) == 5
  assert digits(98765) == 315
  assert digits(5576543) == 2625
  assert digits(2468) == 0
output: def digits(n):
      result = 1
      has_odd = False
      while n > 0:
          digit = n % 10
          if digit % 2 != 0:
              result *= digit
              has_odd = True
          n //= 10
      return result if has_odd else 0