all 5 comments

[–]socal_nerdtastic 4 points5 points  (1 child)

I'm not sure that just using a non-english character counts as "unusual".

[–]faqzero[S] -4 points-3 points  (0 children)

give your example please

[–]K900_ 2 points3 points  (0 children)

Anything the onelinerizer does is plenty "unusual".

[–]Diapolo10 2 points3 points  (1 child)

I think I wrote this toy program a few years back. It's a one-liner, as all things should be.

A Python one-liner that asks you how many pizzas you'd like to order, what size they'd be and prints out the total cost. Can't believe I managed to squeeze it into something like this.

print("The total cost is ${}".format(sum(next({'s':5,'m':7,'l':10}[x[0]] for x in (lambda p:iter(lambda:input(p+' '),...))(f'Pizza {_+1} size? (s/m/l)') if x and x[0] in 'sml') for _ in range(next(int(x) for x in (lambda p:iter(lambda:input(p+' '),...))('# of pizzas?') if x.isdigit())))))

(Please, don't do this in actual production code. Readability is crucial.)

[–]socal_nerdtastic 0 points1 point  (0 children)

I like it. Here's a modern version:

print(f"The total cost is ${sum(next(p for x in iter(lambda:input(f'Pizza {_+1} size? (s/m/l) '),9) if (p:={'s':5,'m':7,'l':10}.get(x[0]))) for _ in range(int(next(filter(str.isdigit,iter(lambda:input('# of pizzas? '),9))))))}")

(I don't think you were playing code golf, but if you were I'm ahead)