[python-advocacy] How programming language webpages should be designed
Michael Foord
fuzzyman at voidspace.org.uk
Thu Nov 12 19:37:18 CET 2009
Ray Allen wrote:
> I'd like
>
> > to see it possible to execute the code too.
>
> http://codepad.org/eRDY42Lj
>
>
> ***Hopefully, we'd be able to allow interactive execution thereby
> allowing the user to guess ouptut first and witness the shuffle
> function in action. I lvery much like the interactive shell used for
> the tutorial on the ruby site.
>
One possibility would be "Try Python". It uses Silverlight to execute
Python *in* the browser:
http://www.trypython.org/
All the best,
Michael Foord
> A dict would be nice too, but I don't want so much in one snippit
> that it becomes hard to follow.
>
> I like that your code has some marketing embedded in it.
>
>
> ***Thanks. The code as it stands is simple to follow, but it includes
> quite a few concepts: the use of a standard library funciton; list
> creation; list method; iteration; strings; integer; print output.
> In hindsight, I guess it would remain simple and readable if we added
> a bit more flow control (such as an if statement) but I'm not sure
> about dictionaires or classes. These are soon discovered in the
> tutorial/documentation and are probably best avoided if this is just
> intended to give a taster.
>
> """Example Python Program"""
>
> import random
>
> # Create and add to a list
> python = []
> python.append("Easy to read")
> python.append("Fast to code")
> python.append("Quick to learn")
> python.append("Modular and object oriented")
> python.append("Open source and cross platform")
>
> # Shuffle list
> random.shuffle(python)
>
> # Loop through list
> count = 1
> print "Python is ... "
> for each in python:
> print count,each
> count += 1
>
> print "Discover more at http://www.python.org"
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Advocacy mailing list
> Advocacy at python.org
> http://mail.python.org/mailman/listinfo/advocacy
>
--
http://www.ironpythoninaction.com/
More information about the Advocacy
mailing list