+5

1 Line Code [Challange]

what can you do with just One and only One line of code.

2/14/2018 2:44:40 AM

Nikhil

11 Answers

New Answer

+6

heres my biggest 1 liner... it prints all subsets even with all permutation... only basic keywords used... https://code.sololearn.com/cZ41Ge58z6zk/?ref=app

+9

One liner function. https://code.sololearn.com/cZHqRVLoT4WX/?ref=app https://code.sololearn.com/cxBxlUXLwMwM/?ref=app

+8

here I count vowels in input: https://code.sololearn.com/cTL8373r1y9L/?ref=app but much more can be done :p

+5

Here's mine. A simple one. https://code.sololearn.com/cjM6Pf930FqP/?ref=app

+4

You can put everything in a single line. (exept for single line comments...) Readability is just at -5/10 So whole games could fit into a single line...

+1

https://code.sololearn.com/cyF6pXF6n7NS/?ref=app

+1

https://code.sololearn.com/cu1io5pwFdBf/?ref=app

+1

https://code.sololearn.com/cdq7Vcbzjt6A/?ref=app

+1

https://code.sololearn.com/cdq7Vcbzjt6A/?ref=app

0

My first one-liner: https://code.sololearn.com/ciSxUtF2L9H4/?ref=app I wrote it with the knowledge SoloLearns Python-tutorial gives from its start to the using of range(). Now, after learning more Python, I understand there would have been also easier ways, but this is my first one-liner. And the only one, for now.

0

Juan Prieto Isn't that a little cheating? I mean, in a pure one-liner there shouldn't be more than one line, and depending on language, one semicolon, I guess. Of course you cant do it like that in Java, but I think there should be only one "fair" line of code in the main-class, when using programming languages as Java, C, C++, C#...