+ 21
[Challenge] for runAways: Output the return but no output of function itself
There was a post related to python: Given a function with output(print) and return. Show the return w.o outputting the print. Example def challenge(): print("dont print this") return("only print this") print(challenge() ) should output only print this. Transfer it to your language as you use a method instead of. Here is Yans Post https://www.sololearn.com/discuss/1368410/?ref=app
26 Respostas
+ 12
https://code.sololearn.com/c1TIbfKOYpK2/?ref=app
macros are hilarious
+ 16
+ 15
1) Mods are not primarily responsible for reviewing lessons/assignments/quizzes.
2) I can totally see why this is "too far off" to be published.
https://code.sololearn.com/c3S6oZy3v1tC/?ref=app
+ 14
Tried to match the pattern as closely as possible:
https://code.sololearn.com/cFq3TW3PEt9S/?ref=app
edit: switched to puts() vs printf() + made print override a default parameter, now matches better :)
+ 13
Conditional printing function
https://code.sololearn.com/c533oiE5YGpS/#py
https://code.sololearn.com/c7DJ7OeUwS1S/#py
+ 10
It turns out that I was blinded by trying to get ctypes to work. This is all that's required:
def fn(print=tuple):
print("nothing")
return("something")
print(fn())
+ 8
I have found an easy easy python solution... a bit proud, to be honest.
https://code.sololearn.com/cja32mtbJ7ne/?ref=app
+ 7
Maybe like this, I kept it simple:
https://code.sololearn.com/cKMEu4w43bKZ/?ref=app
+ 6
Jokes aside, thanks for the challenge. This can actually be practical at toggling debug mode for a small project, for instance.
+ 6
Many solutions try to manipulate the function.
But regard the function as totally normal.
The idea should work for ANY function that prints and returns.
+ 5
Dear mods (SL),
It is too far away from what you like as assignment.
So I did it this way.
+ 5
Ruby: Set $stdout to null
https://code.sololearn.com/cO80cv9yyC7b/#rb
+ 5
Kirk Schafer not exactly what I wanted but special award for creativity.
+ 5
Paul Caron so we can welcome JS too!
+ 4
Hatsy Rei
1. correction
2. nice solution (-;
c++ is a 3liner for it.
+ 4
You can also safe all not printed values.
https://code.sololearn.com/cq6Fqr2iLAEZ/?ref=app
+ 4
When I look at the possibilities we should be very carefully when we call Modules in Phyton. They are Blackboxes and can do anything with our Data.
+ 4
Sebastian KeĆler yes,
totally easy to write a virus.