from jelly import*
a=sys.argv
main(a[1],[*map(try_eval,a[2:])],'')
ŒV
Try it online! (Jelly)
Try it online! (Python)
Both error after executing the other language.
This is a bit of a cheat tbh. Jelly has an "execute as Python" builtin, ŒV
, and, as of April 9, 2018, Jelly is a pip
-installable package, meaning that we can just import it and run it.
How they work
Jelly ignores every line except for the last, and just runs that:
ŒV - Main link. Takes a string on the left
ŒV - Execute the string as Python code
For some reason, I think because of the [...]
in the above lines, there's some parsing error thrown afterwards.
For Python, we import the contents of the jelly
package, read and evaluate the command-line arguments, then run the program in the first command-line argument with the values in the second and third arguments