<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Geronimo89.dk &#187; python</title>
	<atom:link href="http://geronimo89.dk/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://geronimo89.dk</link>
	<description>A blog about me, my doings and everything I think deserves attention.</description>
	<lastBuildDate>Sun, 29 Jan 2012 12:02:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>flexible dice</title>
		<link>http://geronimo89.dk/2008/06/08/flexible-dice/</link>
		<comments>http://geronimo89.dk/2008/06/08/flexible-dice/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 23:25:32 +0000</pubDate>
		<dc:creator>Jonathan Hethey</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://geronimo89.dk/blog/?p=117</guid>
		<description><![CDATA[Finally, it&#8217;s done. I&#8217;ve played with the idea of a flexible dice for quite a time, but I&#8217;ve finally managed to code it (now that I&#8217;m finished I see that it really is no big deal). My goal with this program was a dice with sides the user could define and it should be able [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://geronimo89.dk/blog/wp-content/dice.png"><img class="alignnone size-medium wp-image-125" title="dice" src="http://geronimo89.dk/blog/wp-content/dice-300x289.png" alt="dice 300x289 flexible dice" width="300" height="289" /></a></p>
<pre class="brush: python; title: ; notranslate">
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# author: Jonathan M. Hethey
# website: http://geronimo89.dk
# A flexible dice that can help you making decisions
import random	# it's necessary to import this function to choose a random number from a range later
print(&quot;Please insert your choices, press enter and make the dices roll with \&quot;end\&quot;&quot;)	# This gives the user an idea how this works&amp;lt;/div&amp;gt;
Options = []		# introducing the array/list
while &quot;end&quot; not in Options:		# as long as &quot;end&quot; is not an entry in &quot;Options
Options.append(raw_input(&quot;&quot;))		# the keyboard entries are being added to Options
Options.remove(&quot;end&quot;)		# removing &quot;end&quot; from the list
randomsum = len(Options)		# reading the length of the list, defining the randrange
randomnumber = random.randrange(randomsum)		# the random function
print &quot;The dice tells you: &quot;, Options[randomnumber]		# Here the right entry is read from the list
</pre>
<p>Finally, it&#8217;s done. I&#8217;ve played with the idea of a flexible dice for quite a time, but I&#8217;ve <strong>finally</strong> managed to code it (now that I&#8217;m finished I see that it really is no big deal). My goal with this program was a dice with sides the user could define and it should be able to have as many options as wanted. Documented version in German and English is attached to this post. If you want to run this within Linux you probably need the python or python2.5 package provided by the team of your distribution. If you want to use it with Windows, maybe <a href="http://geronimo89.dk/blog/?p=118">my little guide to cygwin</a> could help you.</p>
<div id="crp_related"><h4>Related Posts:</h3><ul><li><a href="http://geronimo89.dk/2010/12/20/call-for-links/" rel="bookmark" class="crp_title">call for links</a></li><li><a href="http://geronimo89.dk/2010/05/12/batch-editing-html-files/" rel="bookmark" class="crp_title">Batch editing html or text files</a></li><li><a href="http://geronimo89.dk/2010/08/29/little-web-clock/" rel="bookmark" class="crp_title">little web clock</a></li><li><a href="http://geronimo89.dk/2010/10/02/css3-close-up-transition/" rel="bookmark" class="crp_title">CSS3 Close Up: transition</a></li><li><a href="http://geronimo89.dk/2010/10/14/winner-and-another-thing-i-like-axe-anti-hangover/" rel="bookmark" class="crp_title">Winner and another thing I like: Axe anti hangover</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://geronimo89.dk/2008/06/08/flexible-dice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>coding</title>
		<link>http://geronimo89.dk/2006/09/16/coding/</link>
		<comments>http://geronimo89.dk/2006/09/16/coding/#comments</comments>
		<pubDate>Sat, 16 Sep 2006 11:27:08 +0000</pubDate>
		<dc:creator>Jonathan Hethey</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://geronimo89.dk/blog/?p=7</guid>
		<description><![CDATA[Since I always was focussed on design I decided that my lousy skills needed some work on them. I started nosing around about the topic and found things I could use. The site freetechbooks.com offers a lot of free documents containing computer science and programming. The ebook I am reading right now is written as [...]]]></description>
			<content:encoded><![CDATA[<p>Since I always was focussed on design I decided that my lousy skills needed some work on them. I started nosing around about the topic and found things I could use. The site <a title="freetechbooks.com" href="http://www.freetechbooks.com">freetechbooks.com</a> offers a lot of free documents containing computer science and programming. The ebook I am reading right now is written as an introduction to programming with <a title="python" href="http://www.python.org/">python</a>. It&#8217;s called <a title="think like a computer scientist" href="http://greenteapress.com/thinkpython/">think like a computer scientist</a>. After only 3 chapters I can tell it really helps understanding essentials. Moni and me are doing the <a title="php-q.tutorial" href="http://tut.php-q.net">php-q tutorial</a> together and having some fun with that too. While writing this entry I found another easy and fun to learn language, it&#8217;s called ruby and you can try it online <a title="here" href="http://tryruby.hobix.com/">here</a>. <a title="Python" href="http://www.python.org/">Python</a> and <a title="Ruby" href="http://www.ruby-lang.org/en/">Ruby</a> are, as far as I could experience, following the KISS principe (keep it simple stupid).</p>
<p>Let&#8217;s have a short look at methods in <a title="ruby" href="http://www.ruby-lang.org/en/">ruby</a>:</p>
<p><code>geronimo@Zero-1:~$ irb1.8<br />
irb(main):001:0&gt; def greetings(name)<br />
irb(main):002:1&gt; puts "Rise and shine #{name}..."<br />
irb(main):003:1&gt; end<br />
=&gt; nil<br />
irb(main):004:0&gt; greetings("sleepyhead")<br />
Rise and shine sleepyhead...<br />
=&gt; nil<br />
</code></p>
<div id="crp_related"><h4>Related Posts:</h3><ul><li><a href="http://geronimo89.dk/2008/05/27/shshsshhh-hsss/" rel="bookmark" class="crp_title">Shshsshhh Hsss!</a></li><li><a href="http://geronimo89.dk/2006/10/31/coding-projects/" rel="bookmark" class="crp_title">coding projects</a></li><li><a href="http://geronimo89.dk/2008/06/07/cygwin/" rel="bookmark" class="crp_title">cygwin</a></li><li><a href="http://geronimo89.dk/2010/04/28/google-summer-of-code-2010/" rel="bookmark" class="crp_title">Google Summer of Code 2010</a></li><li><a href="http://geronimo89.dk/2008/06/08/flexible-dice/" rel="bookmark" class="crp_title">flexible dice</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://geronimo89.dk/2006/09/16/coding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

