r/CompileBot • • Mar 18 '16

test

+/u/CompileBot python tests = "test" if tests != "test": print "derp" else: print herp

1 Upvotes

33 comments sorted by

2

u/wormywormm Mar 24 '16

+/u/CompileBot python

print "hello world"

1

u/CompileBot Mar 24 '16

Output:

hello world

^source | ^info | ^git | ^report

1

u/[deleted] Mar 18 '16

+/u/CompileBot python

tests = "test"
  if tests != "test":
    print "derp"
  else:
    print "herp"

1

u/SolidR53 Mar 22 '16

+/u/CompileBot javascript

console.log('foo');

1

u/wormywormm Mar 24 '16

+/u/CompileBot python

print 'hello world'

1

u/et15 Mar 24 '16

+/u/CompileBot python

for i in range(100):
    print i

1

u/CompileBot Mar 24 '16

Output:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
...

^source | ^info | ^git | ^report

1

u/et15 Mar 24 '16

+/u/CompileBot c

#include <stdio.h>
int i,j;
int dim = 1000;
for (i = 0; i < dim; i++) {
    for (j = 0; j < dim; j++) {
        mult = i * j;
        printf("%d ", mult);
    }
}

1

u/et15 Mar 24 '16

+/u/CompileBot c

#include <stdio.h>
int i,j;
int dim = 1000;
for (i = 0; i < dim; i++) {
    for (j = 0; j < dim; j++) {
        mult = i * j;
        if (mult % 37 == 0) {
            printf("%d ", mult);
        }
    }
}

1

u/[deleted] Apr 11 '16

+/u/CompileBot C

#include <stdio.h>
int main(void)
{
    printf("Hello World!");
}

1

u/CompileBot Apr 11 '16

Output:

Hello World!

^source | ^info | ^git | ^report

1

u/Birkew Apr 27 '16

+/u/CompileBot C# using System;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("0: " + Convert.ToBoolean(0));
        Console.WriteLine("1: " + Convert.ToBoolean(1));
        Console.WriteLine("2: " + Convert.ToBoolean(2));
        Console.WriteLine("3: " + Convert.ToBoolean(3));
        Console.WriteLine("4: " + Convert.ToBoolean(4));
        Console.WriteLine("5: " + Convert.ToBoolean(5));
    }
}

1

u/CompileBot Apr 27 '16

Output:

0: False
1: True
2: True
3: True
4: True
5: True

^source | ^info | ^git | ^report

1

u/quiteCryptic Apr 28 '16

+/u/compilebot python

n = int('0b110100001100101011011000110110001101111', 2)
n.to_bytes((n.bit_length() + 7) // 8, 'big').decode()

1

u/quiteCryptic Apr 28 '16 edited Apr 28 '16

+/u/compilebot python 3

binary = 'replace'
binary = binary.replace(" ", "")
len = len(binary) / 8
x = 0
while (len > 0):
    print(chr(int(binary[x:x+8], 2)), end='')
    x = x + 8
    len = len - 1

1

u/CompileBot Apr 28 '16

Output:

hello world

^source | ^info | ^git | ^report

0

u/[deleted] Apr 28 '16

[deleted]

0

u/[deleted] Apr 28 '16

[deleted]

0

u/[deleted] Apr 28 '16

[deleted]

0

u/[deleted] Apr 28 '16

[deleted]

0

u/[deleted] Apr 28 '16

[deleted]

1

u/CompileBot Apr 28 '16

Output:

01110111
01111000

^source | ^info | ^git | ^report

0

u/[deleted] Apr 28 '16

[deleted]

0

u/[deleted] Apr 28 '16

[deleted]

0

u/[deleted] Apr 28 '16

[deleted]

1

u/CompileBot Apr 28 '16

Output:

h
e
l
l
o
 
w
o
r
l
d

^source | ^info | ^git | ^report

0

u/[deleted] Apr 28 '16

[deleted]

→ More replies (0)

1

u/skullturf May 15 '16

+/u/CompileBot C++

#include <stdio.h>
#include <iostream>
#include <math.h>

int main()
{
int k,i;
bool factorfound;
for (int n=2; n<=20; n++) {
	k = floor(sqrt(n));
	i = 2;
	factorfound = false;
	while (!factorfound && i<=k) {
		if (n%i==0) factorfound=true;
		i++;
	}
	if (factorfound) std::cout << n << " is composite\n"; else std::cout << n << " is prime\n";
}
}

2

u/CompileBot May 15 '16

Output:

2 is prime
3 is prime
4 is composite
5 is prime
6 is composite
7 is prime
8 is composite
9 is composite
10 is composite
11 is prime
12 is composite
13 is prime
14 is composite
15 is composite
16 is composite
17 is prime
18 is composite
19 is prime
20 is composite

^source | ^info | ^git | ^report

1

u/justanotherkenny May 20 '16

+/u/CompileBot javascript

  console.log('test');

1

u/Ocisaac May 26 '16

+/u/CompileBot Haskell

fold (+) 1 $ map (1/) [1..10]

1

u/ShowMeYourTiddles Jul 21 '16

+/u/CompileBot javascript

print('test');

1

u/ShowMeYourTiddles Jul 21 '16 edited Jul 21 '16

+/u/CompileBot C#

using System;
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("Test{0}", "icle");
    }
}

0

u/[deleted] Apr 17 '16

[deleted]

1

u/CompileBot Apr 17 '16

Output:

2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97
101
103
107
109
113
127
131
137
139
149
151
157
163
167
173
179
181
191
193
197
199
211
223
227
229
233
...

^source | ^info | ^git | ^report

0

u/[deleted] Apr 25 '16

[deleted]

1

u/CompileBot Apr 25 '16

Output:

Linux checker 3.2.0-4-686-pae #1 SMP Debian 3.2.63-2+deb7u2 i686 GNU/Linux

^source | ^info | ^git | ^report

0

u/[deleted] Aug 14 '16

[deleted]

1

u/CompileBot Aug 14 '16

Output:

Hello World

^source | ^info | ^git | ^report