[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

One Line Python

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 15
Thread images: 2

File: python.png (7KB, 144x144px) Image search: [Google]
python.png
7KB, 144x144px
So you think you're cool, eh?

One Line Python challenge: Write programs using only a single line of Python. No newlines or semicolons.

Challenges:

Baby mode: Loop print integers 1 to 100
Easy mode: Fizzbuzz
Medium mode: Arithmetic parser and calculator.
Math mode: Write a program that estimates the values of integrals.
Hell mode: Define a Polygon and Square class, create a square instance and call some methods on it, do some polygon collison tests, etc.
>>
Here's a freebie to start you guys off:

list(map(print, range(1, 101)))
>>
I couldn't be fucked trying to make it pretty or even more minimalist.

for i in range (1, 101):print 'FizzBuzz' if not i%15 else 'Buzz' if not i%5 else 'Fizz' if not i%3 else i
>>
>>51505223
>one line
>>
>>51505223
for i in range (1, 101):print 'FizzBuzz' if not i%15 else 'Buzz' if not i%5 else 'Fizz' if not i%3 else i 

>Not using python3
>>
>>51505631
> no semicolons
fails
>>
>>51504921
list(map(...))

Why did they have to do this? I want a strict map function again.
>>
>>51504856
>one line
http://pastebin.com/gUBmYj8h

I know it's three lines (or 4 if you count the standard boilerplate), but I hope you can forgive me.
>>
>>51505712
>http://pastebin.com/gUBmYj8h
What even is that?
>>
>>51506193
Try it :^)

Note that when it ask for an upper bound, this a non-strict bound (because of an off-by-one error).
>>
>>51506421
>non-strict
I mean strict.
>>
>>51506421
Well, I mean that's impressive.
>>
>>51506479
https://github.com/csvoss/onelinerizer

:|
>>
>>51506490
>https://github.com/csvoss/onelinerizer
Not what I used, though. That's done by hand and a couple of Emacs macros.
>>
Do your own homework faggot.
Thread posts: 15
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.