I just found a meta-quine.
[...]
|
|
|||
|
I just found a meta-quine. [...] Here‘s an elegant solution to the FizzBuzz problem done in Python with list comprehensions and the new x if y else z syntax: print ['FizzBuzz' if not n % 15 else 'Fizz' if not n % 3 else 'Buzz' if not n % 5 else n for n in range(1,101)] Another list comprehension, this time [...] Go check Python.org for the joyful news. Perl y Python tienen dos construcciones idiomáticas para crear una lista de palabras. La de Perl, mucho más conocida, usa el operador qw: qw(foo bar baz quux); En Python, el resultado equivalente se logra con split: “foo bar baz quux”.split() So now you know. |
|||
|
© 2003 - 2012 Adriania Log in 31 queries. 0.275 seconds. |
|||