Your code has a lot of issues:
- Your indentation is off. Indentation is very important in Python since that is how it knows what goes with what.
- You need to use
isinstance to see if an object is a float. I assume this is what you are trying to do with a == float. But, that doesn't make sense because, in Python 3.x., input always returns a string object. So, a is a string. However, if float is actually a variable, then you should change its name. Naming a variable float is a bad practice since it overrides the built-in.
- You are missing a colon at the end of each
else.
- You are missing a closing parenthesis on the first line.
- The
str in the first line is unnecessary (not an error, but I just thought I'd mention it).
However, instead of fixing all this, I'm going to introduce you to the bin built-in:
>>> n = 127
>>> bin(n)
>>> # The "0b" at the start means "binary".
'0b1111111'
>>> # This gets rid of the "0b"
>>> bin(n)[2:]
'1111111'
>>>
It was built explicitly to do what you are trying to do.
Also, here are some references on Python you might enjoy:
http://www.tutorialspoint.com/python/python_overview.htm
http://wiki.python.org/moin/BeginnersGuide/Programmers
a == floatdo what I want?" Since you didn't ask a question, it is hard to know which question to answer. Please edit your post to include a specific question.