Skip to main content
2 of 3
Added an alternative full-program version.
jqkul
  • 2.3k
  • 1
  • 18
  • 24

Python to CJam, 18 bytes

lambda n:"{%f+}"%n

The Python does a basic string format. %f is the code for a float, and since I wouldn't lose any bytes for handling floats, I went ahead and did so.

The CJam is much the same as the Golfscript->CJam answer. It looks something like this:

{7.4+}

or:

{23+}

It's a block that takes the top value off the stack, pushes the special number, then adds them.

Edit: An alternative which is a full program.

print"{%f+}"%input()

(20 bytes)

This only works in Python 2.

jqkul
  • 2.3k
  • 1
  • 18
  • 24