title: How to check if a value is binary or not
body: <p>I'm making a program that converts binary to octal, decimal, and hexidecimal values. How do I check if the user's input value is a binary number or not? 
  Here's the code: </p>
  
  <pre><code>def repeat1():
      if choice == 'B' or choice == 'b':
          x = input("Go on and enter a binary number: ")
          y = int(x, 2)
          print(x, "in octal is", oct(y))
          print(x, "in decimal is", y)
          print(x, "in hexidecimal is", hex(y))
          print(" ")
          def tryagain1(): 
              print("Type '1' to convert from the same number base")
              print("Type '2' to convert from a different number base")
              print("Type '3' to stop")
              r = input("Would you like to try again?")
              if r == '1':
                  repeat1()
              elif r == '2':
                  loop()
              elif r == '3':
                  print("Thank you for using the BraCaLdOmbayNo Calculator!")
              else:
                  print("You didn't enter any of the choices! Try again!")
                  tryagain1()
          tryagain1()
  </code></pre>
  
  <p>Thank you in advance!</p>