I'd like<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
> to see it possible to execute the code too.<br>
<br>
</div><a href="http://codepad.org/eRDY42Lj" target="_blank">http://codepad.org/eRDY42Lj</a><br></blockquote><div class="im"><br>***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. <br>
<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">A dict would be nice too, but I don't want so much in one snippit<br>
that it becomes hard to follow.<br>
<br>
I like that your code has some marketing embedded in it.<br></blockquote><div><br>***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.<br>
<br>"""Example Python Program"""<br><br>import random<br><br># Create and add to a list<br>python = []<br>python.append("Easy to read")<br>python.append("Fast to code")<br>
python.append("Quick to learn") <br>python.append("Modular and object oriented")<br>python.append("Open source and cross platform")<br><br># Shuffle list<br>random.shuffle(python)<br><br># Loop through list<br>
count = 1<br>print "Python is ... "<br>for each in python:<br> print count,each<br> count += 1<br><br>print "Discover more at <a href="http://www.python.org">http://www.python.org</a>" <br><br>
<br></div></div><br>