code: 
  
  
  
  
  
  def 						A_			(  lowercase_  )			->						int:
         barcode //= 10  # exclude the last digit
         _snake_case      :							List[str]     				=						False
         _snake_case      :							Optional[Any]     				=						0
  
         # extract and check each digit
         while barcode != 0:
                _snake_case      :							Dict     				=						1 if checker else 3
                s += mult * (barcode % 10)
                barcode //= 10
                _snake_case      :							List[str]     				=						not checker
  
         return (10 - (s % 10)) % 10
  
  
  
  
  def 						A_			(  lowercase_  )			->						bool:
         return len(str(lowercase_  )  ) == 13 and get_check_digit(lowercase_  ) == barcode % 10
  
  
  
  
  def 						A_			(  lowercase_  )			->						int:
         if str(lowercase_  ).isalpha():
                _snake_case      :							Optional[int]     				=						f'''Barcode \'{barcode}\' has alphabetic characters.'''
                raise ValueError(lowercase_  )
         elif int(lowercase_  ) < 0:
                raise ValueError('''The entered barcode has a negative value. Try again.'''  )
         else:
                return int(lowercase_  )
  
  
  if __name__ == "__main__":
       import doctest
  
       doctest.testmod()
       lowerCAmelCase_   =   get_barcode(input("Barcode: ").strip())
  
       if is_valid(barcode):
            print(F"""'{barcode}' is a valid barcode.""")
       else:
            print(F"""'{barcode}' is NOT a valid barcode.""")
  
  
  
  
  
  
  
style_context: 
  
  
  
  
  
  def 						A_			(  lowercase_  )			->						list:
         if len(lowercase_  ) <= 1:
                return data
         else:
                return [
                    *quick_sort([e for e in data[1:] if e <= data[0]]  ),
                    data[0],
                    *quick_sort([e for e in data[1:] if e > data[0]]  ),
                ]
  
  
  if __name__ == "__main__":
     import doctest
  
     doctest.testmod()
  
  
  
  
  
  
  