The Python Challenge – Warming Up

My nephew is doing The Python Challenge and my daughter has just started Python at school.  I thought that it might be fun to have a play.  I know nothing about python really, other than there are annoyingly two subtly different versions, version 2.x and 3.x

So I thought I would have a play and try doing the challenge in both languages.

Warming Up

OK, so this looks like you need to replace the 0 in the URL (http://www.pythonchallenge.com/pc/def/0.html) with 2 to the power of 38.  Even I could do this I thought.  It didn’t take long

A quick google on how to launch the browser, and the small problem of changing a LONG in to a STRING and it was done.  This works in both 2.7.5 and 3.0

import webbrowser
new = 2
warmingupurl = "http://www.pythonchallenge.com/pc/def/" + str(2 ** 38) + ".html"
webbrowser.open(warmingupurl,new=new)