#By Dylan Myers for Spotify Puzzles. 01/5/13 while True: try: input = int(raw_input('Pick a number in range 1-150 >>> ')) except ValueError: # just catch the exceptions you know! print 'Please only enter a number' else: if 1 <= input < 100: # this is faster nob = bin(noa) # haha, nob... convert no a to binary noc = nob[::-1] # reverse no b nod = int(noc) # convert reversed binary to int print nod break else: print 'Max is 150 please enter a smaller number'
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question