+ 17
[challange] write a python program with output "Hello world" with a little handicap...
.... the character "p" is forbidden in the whole coding exception is the keyword import, no print, no map,.... have fun
29 Antworten
+ 6
I solved it without "p"s or "P"s
+
I solved it without "e"s or "E"s
Solution in the link
https://code.sololearn.com/cHbYf8aZHlt3/?ref=app
+ 25
Here it is 😉
https://code.sololearn.com/cAsxKJND4Cfz/?ref=app
+ 13
Python without 'p' 😂
Here is mine:
exec('chr(ord("o")+1)rint("Hello World")');
+ 13
Anna
You were right, that was possible, with __builtins__ involved. After getting some help from stackoverflow, here it is:
The best i reached is: without a, e, f, g, h, j, k, m, o, p, q, v, w, x, y, z
I think it is also possible to add 'c' to the list, but no time now ...
https://code.sololearn.com/cNLgKTn3GnFF/?ref=app
+ 11
I used only one p in import (It is allowed?):
https://code.sololearn.com/cl7zF3cVf79j/?ref=app
+ 11
Found this even if not 100% correct
https://code.sololearn.com/cOUVpTwnGRWH/?ref=app
+ 11
I propose a next step in this challenge :
Hard level = same assignment, not only 'p' forbidden, but also 'e' !!
(Not sure it's possible with python)
+ 10
Lipogram code !
Nice idea.
https://code.sololearn.com/c9jXhZTrpBZr/#py
What about 'sulqw Khoor Zruog' ?
https://code.sololearn.com/ce6Yzve03WBX/#py
+ 10
Anna
Hey Anna !
I was looking in this direction too, unfortunately 'print' is not included in dir('__builtins__').
'import builtins' is needed, and writing it uses a 'p'
So I found a solution that will work on the web version of SL only, and ... I'm not so proud of it.
https://code.sololearn.com/cqoaowCNM6W6/?ref=app
+ 9
I also used one p in import, is this allowed?
https://code.sololearn.com/c7gB6AHzRsW8/?ref=app
+ 7
Wow ...
Sorry guys, I cant mark one answer as best!
It is not the one answer which I really like but so many different solutions like
-hiding p with an expression for p in all tastes
- warning
- python egg
- use stdout instead of print
Thanks to all posts for it!
+ 6
@Ferhat yes.. a further version
+ 5
@Paul,, yes it is allowed. Very nice solution!
+ 5
Cépagrave I'm already playing it with as least alphabets as possible 🤣
...wait, without 'e' !?
no exec, no eval, no write
is that possible!? 🤔
------------------------------------------------------
here's the code without 'p' and with 1 'e'
https://code.sololearn.com/c7zv2SqQlASQ
+ 5
Cépagrave I think it might be possible in python. Maybe if you call the print function via __builtins__.print.__call__(), but instead of calling the function directly, you use something like dir(dir(__builtins__)[])[] with the indices of the print and call functions in the square brackets... It's difficult though and probably won't run on every device
+ 5
Cépagrave Congratulations, very well done 👍
Every method I found just returned the function name as a string ("print") and I would have needed eval or exec to actually run it
(Btw, how can I reply to a comment or address a user directly?)
+ 5
Darya Zykin nice! a new solution
+ 5
This program outputs 'Hello World!' on the screen without any print statemant. It's not actually without any 'p', but at least the print() function is not used
https://code.sololearn.com/cW4X91aHyYrQ/?ref=app
+ 3
well... eval is good to use :D
https://code.sololearn.com/c4EBOP6Xx89Z