Solutions for the Python Challenge

Show possible solutions for: All levels; level: previous, 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, next

Possible solution for level 19

URI:
http://www.pythonchallenge.com/pc/hex/bin.html
Log-in data:
Username: butter; password: fly
Comment:
Possible Solution:
import base64, wave, array

# Input ...

h = open("data")
a = array.array("c", base64.b64decode(h.read()))
a.byteswap()
h.close()

# ... Processing ...

h = wave.open("modified.wav", "wb")
h.setnchannels(1)
h.setsampwidth(1)
h.setframerate(22050)

# ... Output

h.writeframes(a.tostring())
h.close()

(Download this source code.)

Code word for next challenge:
idiot

By Holger Thölking, May 29th, 2007.