How to print "Hello, world!" (in every possible way)
Posted
by Attila Oláh
on Stack Overflow
See other posts from Stack Overflow
or by Attila Oláh
Published on 2010-03-23T09:55:17Z
Indexed on
2010/03/23
10:13 UTC
Read the original article
Hit count: 362
Here's what I', trying to do:
1 language: (Python < 3):
print "Hello, world!"
2 languages: (Python < 3 & Windows Shell, aka .bat file):
rem="""
echo "Hello, world!"
exit
"""
print "Hello, world!"
Next step could be something like bash
. Since the above one raises an exception, I tried to make it not raise exceptions, like this:
rem="""
echo "Hello, world!"
exit
"""
exit=""
exit
print "Hello, world!"
The only issue is, of course, it won't print the hello world. And I really want it to print that hello world for me. Anyone can help with this?
Also, any other language would do it, just don't break the previous ones (i.e. the answer still has to be valid Python code and print out the nice hello world greeting when run with Python.)
Any ideas are welcome.
I'm making this a community wiki so feel free to add ideas to the list.
© Stack Overflow or respective owner