Python challenges 12-14
BIN
python/pythonchallenge.com/0.jpg
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
python/pythonchallenge.com/1.jpg
Normal file
After Width: | Height: | Size: 13 KiB |
3
python/pythonchallenge.com/12 - Evil.py
Normal file
|
@ -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])
|
7
python/pythonchallenge.com/13 - Disproportional.py
Normal file
|
@ -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!!!
|
23
python/pythonchallenge.com/14 - Italy.py
Normal file
|
@ -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')
|
BIN
python/pythonchallenge.com/2.jpg
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
python/pythonchallenge.com/3.jpg
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
python/pythonchallenge.com/4.jpg
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
python/pythonchallenge.com/evil2.gfx
Normal file
BIN
python/pythonchallenge.com/level14.jpg
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
python/pythonchallenge.com/wire.png
Normal file
After Width: | Height: | Size: 16 KiB |
|
@ -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)
|
||||
|
|