diff --git a/python/pythonchallenge.com/0.jpg b/python/pythonchallenge.com/0.jpg new file mode 100644 index 0000000..28c78dc Binary files /dev/null and b/python/pythonchallenge.com/0.jpg differ diff --git a/python/pythonchallenge.com/1.jpg b/python/pythonchallenge.com/1.jpg new file mode 100644 index 0000000..7749447 Binary files /dev/null and b/python/pythonchallenge.com/1.jpg differ diff --git a/python/pythonchallenge.com/12 - Evil.py b/python/pythonchallenge.com/12 - Evil.py new file mode 100644 index 0000000..7f39008 --- /dev/null +++ b/python/pythonchallenge.com/12 - Evil.py @@ -0,0 +1,3 @@ +data = open("evil2.gfx", 'rb').read() +for i in range(5): + open('{0}.jpg'.format(i), 'wb').write(data[i::5]) \ No newline at end of file diff --git a/python/pythonchallenge.com/13 - Disproportional.py b/python/pythonchallenge.com/13 - Disproportional.py new file mode 100644 index 0000000..503584e --- /dev/null +++ b/python/pythonchallenge.com/13 - Disproportional.py @@ -0,0 +1,7 @@ +import xmlrpc.client + +connection = xmlrpc.client.ServerProxy('http://www.pythonchallenge.com/pc/phonebook.php') +print(connection.system.listMethods()) # methods +print(connection.system.methodHelp('phone')) # what does phone do? +print(connection.system.methodSignature('phone')) # takes a string, returns a string +print(connection.phone('Bert')) # italy!!! diff --git a/python/pythonchallenge.com/14 - Italy.py b/python/pythonchallenge.com/14 - Italy.py new file mode 100644 index 0000000..24dab87 --- /dev/null +++ b/python/pythonchallenge.com/14 - Italy.py @@ -0,0 +1,23 @@ +from PIL import Image + +img = Image.open('wire.png') +print(img.size) # the real size is actually 10000x1, not 100x100 + +out = Image.new('RGB', (100, 100)) +delta = [(1, 0), (0, 1), (-1, 0), (0, -1)] # spiral! +x = -1 +y = 0 +p = 0 +d = 200 + +while (d / 2) > 0: + for v in delta: + steps = d // 2 + for s in range(steps): + x = x + v[0] + y = y + v[1] + out.putpixel((x, y), img.getpixel((p, 0))) + p += 1 + d -= 1 + +out.save('level14.jpg') \ No newline at end of file diff --git a/python/pythonchallenge.com/2.jpg b/python/pythonchallenge.com/2.jpg new file mode 100644 index 0000000..c073771 Binary files /dev/null and b/python/pythonchallenge.com/2.jpg differ diff --git a/python/pythonchallenge.com/3.jpg b/python/pythonchallenge.com/3.jpg new file mode 100644 index 0000000..45f9d37 Binary files /dev/null and b/python/pythonchallenge.com/3.jpg differ diff --git a/python/pythonchallenge.com/4.jpg b/python/pythonchallenge.com/4.jpg new file mode 100644 index 0000000..a0e188f Binary files /dev/null and b/python/pythonchallenge.com/4.jpg differ diff --git a/python/pythonchallenge.com/evil2.gfx b/python/pythonchallenge.com/evil2.gfx new file mode 100644 index 0000000..c5860a7 Binary files /dev/null and b/python/pythonchallenge.com/evil2.gfx differ diff --git a/python/pythonchallenge.com/level14.jpg b/python/pythonchallenge.com/level14.jpg new file mode 100644 index 0000000..2f0e085 Binary files /dev/null and b/python/pythonchallenge.com/level14.jpg differ diff --git a/python/pythonchallenge.com/wire.png b/python/pythonchallenge.com/wire.png new file mode 100644 index 0000000..9de8019 Binary files /dev/null and b/python/pythonchallenge.com/wire.png differ diff --git a/readme.md b/readme.md index 312c731..7d2d20e 100644 --- a/readme.md +++ b/readme.md @@ -29,3 +29,6 @@ Here you can find a bunch of random work from my GCSE Computer Science class dum - [9 - Good](python/pythonchallenge.com/9%20-%20Good.py) - [10 - Bull](python/pythonchallenge.com/10%20-%20Bull.py) - [11 - 5808](python/pythonchallenge.com/11%20-%205808.py) + - [12 - Evil](python/pythonchallenge.com/12%20-%20Evil.py) + - [13 - Disproportional](python/pythonchallenge.com/13%20-%20Disproportional.py) + - [14 - Italy](python/pythonchallenge.com/14%20-%20Italy.py)