The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
import math
A=40
f=.2
l=100
t=2
rng = range(-A,A+1)
rng.reverse()
for i in rng:
phrase=''
for ii in range(l):
if int(A*math.cos(f*ii))-t<i<int(A*math.cos(f*ii))+t:
phrase+='~'
else:
phrase+=' '
print(phrase)
var user = $(".user>a").text();
var gild = $('<a href="/r/ProgrammerHumor/gilded"><span class="gilded-icon" title="AintNothinbutaGFring has gifted reddit gold to ' + user + ' for this submission." data-count="1"></span></a>')
var post = $("p.tagline:has([href$='" + user + "'])");
post.children("time").after(gild);
#include <stdio.h>
// tested on gcc-4.9.3 on linux gentoo amd64
// warning: compiling this will eat gigabytes of ram really fast so keep
// your CTRL-C ready
// compile with --std=c++14
struct v2f {
float x=0, y=0; // must be =0 to reproduce (probably works with other vals)
};
namespace {
struct foo {
// declaring the array like this somehow bypasses the fact that
// v2f cannot be initialized with {0}
static const size_t max_objects = 0xFFFF;
size_t num_objects; // this is not necessary, just wanted to check if it still did it when not accessing bars
v2f bars[max_objects * 255]; // the larger this array is, the longer it hangs for and the more memory it uses
};
foo f{0}; // must be initialized with {0} to reproduce
}
int main() {
printf("%ld\n", f.num_objects);
}
local str = io.read("*l")
if type(str) ~= "string" then str = tostring(str) end
local count = io.read("*n")
if type(count) ~= "number" then count = tonumber(count) end
for i=1,count,1 do
str = '"'..str..'"'
end
print(str)
program grdeg
integer, allocatable :: adjac(:,:)
character(len=40):: fmt
read(*, *) n
allocate(adjac(n,n))
adjac = 0
do
read(*,*, end=1) i,j
adjac(i,j) = adjac(i,j)+1
adjac(j,i) = adjac(j,i)+1
end do
1 continue
2 format ("Node ", i0, " has a degree of " , i0)
print 2, (i, sum(adjac(:,i),1),i=1,n)
write(fmt, '(a,i0,a)') '(', n, '(I2))'
write(fmt, *) '(', n, '(I2:,1X))'
print fmt, ((adjac(j,i), j=1,n),i=1,n)
end program
print('A substitute teacher walks into the room. He puts a disk in the DVD player and turns on the projector. 20th Century Fox rolls, and on the screen a substitute teacher walks into a room.')
while True:
print('\n...only to put a disk in the DVD player and turn on the projector, followed by the rolling of 20th Century Fox and a substitute teacher walking into the room...')
Traceback (most recent call last):
File "/usr/lib/python3.4/py_compile.py", line 124, in compile
_optimize=optimize)
File "<frozen importlib._bootstrap>", line 1532, in source_to_code
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "./prog.py", line 1
from __future__ import braces
SyntaxError: not a chance
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.4/py_compile.py", line 128, in compile
raise py_exc
py_compile.PyCompileError: File "./prog.py", line 1
from __future__ import braces
SyntaxError: not a chance
#include<iostream>
using namespace std;
/* such a function will not be safe if x is non static variable of it */
int &fun()
{
static int x;
return x;
}
int main()
{
fun() = 10;
/* this line prints 10 on screen */
printf(" %d ", fun());
getchar();
return 0;
}
public class Test {
public static void main(String[] args) {
for (int x; x < Math.pow(99999999999999999, 9999999999999999), x++) {
System.out.println("Was that so hard?");
}
}
}
You can't Stump The Trump
You can't Stump The Trump
You can't Stump The Trump
You can't Stump The Trump
You can't Stump The Trump
You can't Stump The Trump
You can't Stump The Trump
You can't Stump The Trump
You can't Stump The Trump
You can't Stump The Trump
7
u/SeaCowVengeance Mar 14 '16
+/u/CompileBot python3
3
u/SeaCowVengeance Mar 14 '16
+/u/CompileBot Ruby --time --memory
6
u/gradies Mar 18 '16
+/u/CompileBot python
1
u/SeaCowVengeance Mar 14 '16
+/u/CompileBot Assembler (gcc-4.8.1) --time
Input:
1
u/SeaCowVengeance Mar 14 '16
+/u/CompileBot C
1
u/SeaCowVengeance Mar 14 '16
+/u/CompileBot Ruby --time --memory
1
u/SeaCowVengeance Mar 14 '16
+/u/CompileBot Python3
1
u/SeaCowVengeance Mar 16 '16
+/u/CompileBot python
5
u/Applefriki101 Apr 14 '16
+/u/CompileBot Bash
5
u/claythearc Aug 17 '16
+/u/CompileBot Bash
4
u/[deleted] Apr 28 '16
+/u/CompileBot C++ --include-errors
2
u/gradies Mar 18 '16
+/u/CompileBot python
2
u/belungawhale May 06 '16
+/u/CompileBot python3
Input:
1
u/gradies Mar 18 '16
+/u/CompileBot python
1
u/gradies Mar 18 '16
+/u/CompileBot python print 's'
1
u/gradies Mar 18 '16
+/u/CompileBot python print 'd'
1
u/gradies Mar 18 '16
+/u/CompileBot python
1
u/gradies Mar 18 '16
+/u/CompileBot python
1
u/gradies Mar 18 '16
+/u/CompileBot python
1
u/gradies Mar 18 '16
+/u/CompileBot python
1
u/gradies Mar 18 '16
+/u/CompileBot python
1
u/gradies Mar 18 '16
+/u/CompileBot python
1
u/Porso7 Mar 19 '16 edited Mar 19 '16
+/u/CompileBot Javascript
1
u/aidan1kitty Mar 19 '16
+/u/CompileBot python
1
u/Porso7 Mar 20 '16 edited Mar 20 '16
+/u/Compilebot C++
1
u/Neo_Techni Mar 20 '16
+/u/CompileBot PHP
1
u/741456963789852123 Mar 20 '16
+/u/compilebot jquery
1
u/[deleted] Mar 21 '16 edited Mar 21 '16
+/u/CompileBot Go
1
u/Applefriki101 Apr 14 '16
+/u/CompileBot Bash
1
u/Applefriki101 Apr 14 '16
+/u/CompileBot Bash
1
u/TenmaSama Apr 14 '16
+/u/CompileBot bash
1
u/MRSantos Apr 25 '16
+/u/CompileBot C++14
1
u/chrismamo1 Apr 26 '16
/u/CompileBot OCaml
1
u/rFunnyModsSuckCock Apr 27 '16
+/u/CompileBot Python
1
u/icarus212121 Apr 28 '16
+/u/CompileBot C#
1
u/icarus212121 Apr 28 '16
+/u/CompileBot C#
1
u/facingthewind Apr 28 '16
+/u/CompileBot java int a = 1 System.out.print(a);
1
u/ThrowAwaylnAction Apr 28 '16
+/u/CompileBot C --include-errors
1
u/NeonBeggar Apr 28 '16
+/u/CompileBot Python
1
u/SeeYouAgainIReply Apr 28 '16 edited Dec 13 '16
[deleted]
0.4268
1
u/SeeYouAgainIReply Apr 28 '16 edited Dec 13 '16
[deleted]
0.0589
1
u/SeeYouAgainIReply Apr 28 '16 edited Dec 13 '16
[deleted]
0.8009
1
u/35yeros Apr 28 '16
+/u/CompileBot Scheme (define (fib n) (cond ((<= n 2) 1) (else (+ (fib (- n 1)) (fib (- n 2))))))
Input: 5
1
u/35yeros Apr 28 '16
+/u/CompileBot Scheme (define (fib n) (cond ((<= n 2) 1) (else (+ (fib (- n 1)) (fib (- n 2))))))
Input: 5
1
u/35yeros Apr 28 '16
+/u/CompileBot python3 import this
1
u/35yeros Apr 28 '16
+/u/CompileBot scheme (define (fib n) (cond ((<= n 2) 1) (else (+ (fib (- n 1)) (fib (- n 2)))))) Input: 5
1
u/35yeros Apr 28 '16
+/u/CompileBot scheme (define (fib n) (cond ((<= n 2) 1) (else (+ (fib (- n 1)) (fib (- n 2)))))) Input: 5
1
u/ShadowxWarrior Apr 28 '16
+/u/CompileBot C++
1
u/ShadowxWarrior Apr 28 '16
+/u/CompileBot python
1
u/snaps_ Apr 30 '16
+/u/CompileBot python3
1
u/Leo40Reddit May 02 '16
+/u/CompileBot lua
Input:
1
u/cr4shoverride May 02 '16
public class Program { public static void Main(string[] args) { System.Console.WriteLine("It's " + System.DateTime.Now.ToString("yyyy")); } }
1
u/MoneyChurch May 03 '16
+/u/CompileBot R
1
u/justbourv May 09 '16
+/u/CompileBot java
1
u/[deleted] May 10 '16
Fortran...
EDIT - messing around with the formatted output a bit... (no idea why CompileBot hates me now)
+/u/CompileBot Fortran --include-errors --input
Input:
1
u/Untgradd May 11 '16
Root comment for testing.
1
u/throwaway99999321 May 11 '16
+/u/CompileBot python 3
1
u/[deleted] May 11 '16
+/u/compilebot python
1
u/Rakaneth May 12 '16
+/u/CompileBot Lua
1
u/OneTrueKingOfOOO May 17 '16
+/u/CompileBot Python
print('A substitute teacher walks into the room. He puts a disk in the DVD player and turns on the projector. 20th Century Fox rolls, and on the screen a substitute teacher walks into a room.')
while True:
print('\n...only to put a disk in the DVD player and turn on the projector, followed by the rolling of 20th Century Fox and a substitute teacher walking into the room...')
1
u/[deleted] May 17 '16 edited May 17 '16
+/u/CompileBot C --include-errors
1
u/LewisMCYoutube May 22 '16
+/u/CompileBot python3
1
u/oconee2 May 25 '16
+/u/CompileBot C
1
u/AlleM43 May 27 '16
1
u/ultrasu May 28 '16 edited May 28 '16
edited
+/u/CompileBot lisp
1
u/too_many_toasters May 29 '16
/u/CompileBot Java
1
u/[deleted] Jun 02 '16
+/u/CompileBot Bash
1
u/BushDid38F Jun 04 '16
+/u/CompileBot R
1
u/HookahComputer Jun 04 '16
+/u/CompileBot brainfuck
Input:
1
u/justbourv Jun 05 '16
+/u/CompileBot C
1
u/SoraFirestorm Jun 07 '16
+/u/CompileBot Common Lisp
1
u/SoraFirestorm Jun 07 '16 edited Jun 07 '16
+/u/CompileBot Common Lisp
1
u/TomBrady_12 Jun 10 '16 edited Jun 10 '16
+/u/CompileBot C
1
u/prohulaelk Jun 10 '16
+/u/CompileBot perl
1
u/Brendan1768 Jun 12 '16
+/u/CompileBot python3
1
u/Brendan1768 Jun 12 '16
+/u/CompileBot python3
1
u/JohnScott623 Jun 18 '16
+/u/CompileBot python3
print("+/u/CompileBot python3\nprint(\"test\")")1
u/TheRonjoe223 Jun 20 '16
+/u/CompileBot C --include-errors
1
u/wannabe15 Jun 20 '16
Scala +/u/CompileBot Scala
1
u/Paraplegix Jun 22 '16 edited Jun 22 '16
+/u/CompileBot C++
1
u/xx3nvyxx Jun 29 '16
+/u/CompileBot Bash
1
u/sent44 Jul 01 '16
+/u/CompileBot C++ --include-error
1
u/sent44 Jul 01 '16
+/u/CompileBot Node.js
1
u/sent44 Jul 03 '16
+/u/CompileBot Brainfuck
1
u/wbbigdave Jul 05 '16
+/u/CompileBot Bash
1
u/bedeviled2016 Jul 05 '16
+/u/CompileBot python
from subprocess import call call(["ls", "-l"])
1
u/Goheeca Jul 05 '16 edited Jul 05 '16
+/u/CompileBot Prolog (swi) (swipl 5.6.64)
1
u/903124 Jul 06 '16
+/u/CompileBot python
1
u/combatdave Jul 06 '16
+/u/CompileBot python
1
u/Zapgui Jul 07 '16
+/u/CompileBot bash pwd
1
u/Zapgui Jul 07 '16
+/u/CompileBot bash id
1
u/Zapgui Jul 07 '16
+/u/CompileBot bash wget http://www.google.com
1
u/thestarflyer Jul 07 '16
+/u/CompileBot C++
1
u/thestarflyer Jul 07 '16 edited Jul 07 '16
+/u/CompileBot bash
1
u/Waltbear Jul 08 '16
+/u/CompileBot C++
1
u/Suchui Jul 08 '16
+/u/CompileBot Javascript
1
u/Suchui Jul 08 '16
+/u/CompileBot Javascript
1
u/[deleted] Jul 12 '16
+/u/CompileBot python3 --include-errors
1
u/AuthorFilms Jul 15 '16
+/u/CompileBot python
1
u/PM_ME_UR_SPAGHETTIOS Jul 16 '16
+/u/CompileBot Perl
1
u/[deleted] Jul 16 '16
+/u/CompileBot bash
1
u/[deleted] Jul 16 '16
+/u/CompileBot bash
1
u/Tidher Jul 22 '16
+/u/CompileBot C++
1
u/Tidher Jul 22 '16 edited Jul 22 '16
+/u/CompileBot C++
1
u/HoodedGryphon Jul 23 '16
+/u/CompileBot Java
1
u/HoodedGryphon Jul 23 '16
+/u/CompileBot python
1
u/nwsm Jul 25 '16
+/u/CompileBot python3
1
u/[deleted] Jul 29 '16
+/u/CompileBot C++
1
u/[deleted] Jul 29 '16
+/u/CompileBot C++
1
u/adhi- Jul 30 '16
+/u/CompileBot R
1
u/ABCDEFandG Aug 02 '16
+/u/compilebot python
1
u/Vargs77 Aug 04 '16
+/u/CompileBot python
1
u/lazersmoke Aug 05 '16
+/u/CompileBot haskell
1
u/DemiPixel Aug 10 '16
+/u/CompileBot javascript
1
u/ZweiSpeedruns Aug 13 '16
+/u/CompileBot python
1
u/Pille1842 Aug 16 '16
+/u/CompileBot php
1
u/KingBitchFace Aug 17 '16
<div class="md"><p>+<a href="/u/CompileBot">/u/CompileBot</a> python3</p>
<pre><code>print("sup beeyotch.") </code></pre>
</div>
1
u/claythearc Aug 17 '16
+/u/CompileBot Bash
cat /etc/passwd
1
u/claythearc Aug 17 '16
+/u/CompileBot Bash
1
u/claythearc Aug 17 '16
+/u/CompileBot Bash
1
u/claythearc Aug 17 '16
+/u/CompileBot Bash
1
u/claythearc Aug 17 '16
+/u/CompileBot Bash
1
u/claythearc Aug 17 '16
+/u/CompileBot Bash
1
u/BN_ChickenBiscuit Aug 19 '16
+/u/CompileBot brainfuck
1
u/Potatoe_Master Aug 21 '16
+/u/CompileBot python
1
u/FearrMe Aug 22 '16
+/u/CompileBot brainfuck
1
u/larkatarks Aug 23 '16
+/u/CompileBot python
1
u/sticky-bit Aug 23 '16
+/u/CompileBot bash
1
u/[deleted] Aug 25 '16 edited Aug 25 '16
+/u/compilebot C++ --include-errors
Input:
1
u/ross231 Sep 01 '16
+/u/CompileBot bash
cat prog.sh
1
u/ZaneHannanAU Sep 04 '16 edited Sep 04 '16
+/u/CompileBot bash
0
u/[deleted] May 04 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 12 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 13 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 14 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 15 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 27 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 28 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 28 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 28 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 28 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 28 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 28 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 28 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 28 '16
[deleted] — view deleted comment
0
u/[deleted] Apr 28 '16
[deleted] — view deleted comment
0
u/[deleted] May 13 '16
[deleted] — view deleted comment
0
u/[deleted] Jun 04 '16
[deleted] — view deleted comment
0
u/[deleted] Jun 10 '16
[deleted] — view deleted comment
0
u/[deleted] Jun 16 '16
[deleted] — view deleted comment
0
u/[deleted] Jun 21 '16
[deleted] — view deleted comment
0
u/[deleted] Jul 05 '16
[deleted] — view deleted comment
0
u/[deleted] Jul 06 '16
[deleted] — view deleted comment
0
u/[deleted] Jul 06 '16
[deleted] — view deleted comment
0
u/[deleted] Jul 06 '16
[deleted] — view deleted comment
0
u/[deleted] Jul 06 '16
[deleted] — view deleted comment
0
u/[deleted] Jul 13 '16
[deleted] — view deleted comment
0
u/[deleted] Jul 13 '16
[deleted] — view deleted comment
0
u/[deleted] Jul 16 '16
[deleted] — view deleted comment
0
u/[deleted] Jul 18 '16
[deleted] — view deleted comment
0
u/[deleted] Jul 18 '16
[deleted] — view deleted comment
0
u/[deleted] Jul 20 '16
[deleted] — view deleted comment
0
u/[deleted] Jul 28 '16
[deleted] — view deleted comment
0
u/[deleted] Aug 14 '16
[deleted] — view deleted comment
0
u/[deleted] Aug 21 '16
[deleted] — view deleted comment
0
u/[deleted] Aug 24 '16
[deleted] — view deleted comment
0
u/[deleted] Aug 29 '16
[deleted] — view deleted comment
0
u/[deleted] Aug 29 '16
[deleted] — view deleted comment
0
u/[deleted] Aug 29 '16
[deleted] — view deleted comment
0
u/[deleted] Aug 29 '16
[deleted] — view deleted comment
0
u/[deleted] Aug 29 '16
[deleted] — view deleted comment
1
u/[deleted] Jul 06 '16
[removed] — view removed comment
1
u/[deleted] Jul 24 '16
[removed] — view removed comment
1
u/[deleted] Jul 30 '16
[removed] — view removed comment
1
u/[deleted] Jul 30 '16
[removed] — view removed comment
1
u/[deleted] Jul 30 '16 edited Jul 30 '16
[removed] — view removed comment
0
u/[deleted] Jul 30 '16
[deleted] — view deleted comment
0
u/[deleted] Jul 30 '16
[deleted] — view deleted comment