First, you need to figure out the complicated parts:
>>> 5//2 2 >>> 5/2 2.5
I googled "python double slash" and reached this page: pythonpool.com/python-double-slash/
then you need to figure out what the print statement does.
Trying the function out, I'd say it displays the binary version of the number you used as a starting parameter:
>>> def dec(num): ... if num > 1: ... dec(num//2) ... print(num%2,end='') ... >>> dec(2) 10>>> >>> dec(3) 11>>>
The recursive part might throw you off as well :)
It really looks like a code golfing challenge if you ask me !
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
First, you need to figure out the complicated parts:
I googled "python double slash" and reached this page: pythonpool.com/python-double-slash/
then you need to figure out what the print statement does.
Trying the function out, I'd say it displays the binary version of the number you used as a starting parameter:
The recursive part might throw you off as well :)
It really looks like a code golfing challenge if you ask me !