<?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>TechYoYo &#187; python</title>
	<atom:link href="http://techyoyo.com/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://techyoyo.com</link>
	<description>Tech for the Cool</description>
	<lastBuildDate>Wed, 21 Jul 2010 17:36:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Now is the time to learn Objective &#8211; C</title>
		<link>http://techyoyo.com/2010/01/now-is-the-time-to-learn-objective-c/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=now-is-the-time-to-learn-objective-c</link>
		<comments>http://techyoyo.com/2010/01/now-is-the-time-to-learn-objective-c/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 17:16:48 +0000</pubDate>
		<dc:creator>arun kamath</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[tablet]]></category>

		<guid isPermaLink="false">http://techyoyo.com/?p=213</guid>
		<description><![CDATA[With Apple about to announce its latest revolutionary product &#8211; the Tablet PC, its share value and earnings is bound to rise several times. But importantly, it will help many freelance programmers earn a fortune by developing apps for it. iPhone apps are developed in Objective C.  However, there is an python implementation too. According [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechyoyo.com%2F2010%2F01%2Fnow-is-the-time-to-learn-objective-c%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechyoyo.com%2F2010%2F01%2Fnow-is-the-time-to-learn-objective-c%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>With Apple about to announce its latest revolutionary product &#8211; the Tablet PC, its share value and earnings is bound to rise several times. But importantly, it will help many freelance programmers earn a fortune by developing apps for it.</p>
<p>iPhone apps are developed in Objective C.  However, there is an python <a href="http://www.saurik.com/id/5" target="_blank">implementation </a>too. According to Wikipedia, Objective C is used only on Apple&#8217;s Mac OS x and iPhone OS.</p>
<p>Now with a tablet PC being added to its stable, the developers will have more flexibility and CPU power than the iPhone to develop killer apps. Already it is rumoured that the print media is looking forward to find a way to generate revenue from tablet PC.</p>
<p>So what is objective c? It is an OOP language which adds smalltalk like messaging to C. Here is a <a href="http://developer.apple.com/iphone/library/referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/index.html#//apple_ref/doc/uid/TP40007594" target="_blank">Primer </a>on the language from apple and more detailed <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html" target="_blank">here</a>.</p>
<p>Do you know the language? How do you find it?</p>
<script type="text/javascript" src="http://cdn.socialtwist.com/2009071621213/script.js"></script><a class="st-taf" href="http://tellafriend.socialtwist.com:80" onclick="return false;" style="border:0;padding:0;margin:0;"><img alt="SocialTwist Tell-a-Friend" style="border:0;padding:0;margin:0;" src="http://images.socialtwist.com/2009071621213/button.png"onmouseout="STTAFFUNC.hideHoverMap(this)" onmouseover="STTAFFUNC.showHoverMap(this, '2009071621213', 'http%3A%2F%2Ftechyoyo.com%2F2010%2F01%2Fnow-is-the-time-to-learn-objective-c%2F', 'Now+is+the+time+to+learn+Objective+%26%238211%3B+C')" onclick="STTAFFUNC.cw(this, {id:'2009071621213', link: 'http%3A%2F%2Ftechyoyo.com%2F2010%2F01%2Fnow-is-the-time-to-learn-objective-c%2F', title: 'Now+is+the+time+to+learn+Objective+%26%238211%3B+C' });"/></a>]]></content:encoded>
			<wfw:commentRss>http://techyoyo.com/2010/01/now-is-the-time-to-learn-objective-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Encrypt message using Python</title>
		<link>http://techyoyo.com/2009/08/encrypt-message-python-programming-language/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=encrypt-message-python-programming-language</link>
		<comments>http://techyoyo.com/2009/08/encrypt-message-python-programming-language/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 14:17:10 +0000</pubDate>
		<dc:creator>arun kamath</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://techyoyo.com/?p=85</guid>
		<description><![CDATA[This program makes use Caeser Cipher method for encrypting and decrypting data. From Wikipedia It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 3, A would be replaced by D, B would becomeE, and [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechyoyo.com%2F2009%2F08%2Fencrypt-message-python-programming-language%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechyoyo.com%2F2009%2F08%2Fencrypt-message-python-programming-language%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>This program makes use Caeser Cipher method for encrypting and decrypting data. From <a href="http://en.wikipedia.org/wiki/Caesar_cipher">Wikipedia </a></p>
<blockquote><p><em>It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 3, </em><tt><em>A</em></tt><em> would be replaced by </em><tt><em>D</em></tt><em>, </em><tt><em>B</em></tt><em> would become</em><tt><em>E</em></tt><em>, and so on. The method is named after Julius Caesar, who used it to communicate with his generals.</em></p></blockquote>
<p>Here is the program in python.</p>
<p><span style="color: #ff0000;"># Caesar Cipher &#8211; Simple Substitution Cipher</span></p>
<p><span style="color: #ff0000;">MAX_KEY_SIZE = 26</span></p>
<p><span style="color: #ff0000;">def getMessage():</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;"> print &#8216;Enter your message:&#8217;</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;"> return raw_input()</span></p>
<p><span style="color: #ff0000;">def getMode():</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;"> while True:</span></p>
<p style="padding-left: 60px;"><span style="color: #ff0000;"> print &#8216;Do you wish to encrypt or decrypt a message?&#8217;</span></p>
<p style="padding-left: 60px;"><span style="color: #ff0000;"> mode = raw_input().lower()</span></p>
<p style="padding-left: 60px;"><span style="color: #ff0000;"> if mode in &#8216;encrypt e decrypt d&#8217;.split():</span></p>
<p style="padding-left: 90px;"><span style="color: #ff0000;"> return mode</span></p>
<p style="padding-left: 60px;"><span style="color: #ff0000;"> else:</span></p>
<p style="padding-left: 90px;"><span style="color: #ff0000;"> print &#8216;Enter either &#8220;encrypt&#8221; or &#8220;e&#8221; or &#8220;decrypt&#8221; or &#8220;d&#8221;.&#8217;</span></p>
<p><span style="color: #ff0000;">def getKey():</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;"> key = 0</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;"> while True:</span></p>
<p style="padding-left: 60px;"><span style="color: #ff0000;"> print &#8216;Enter the key number (1-%s)&#8217; % (MAX_KEY_SIZE)</span></p>
<p style="padding-left: 60px;"><span style="color: #ff0000;"> key = int(raw_input())</span></p>
<p style="padding-left: 60px;"><span style="color: #ff0000;"> if (key &gt;= 1 and key &lt;= MAX_KEY_SIZE):</span></p>
<p style="padding-left: 90px;"><span style="color: #ff0000;"> return key</span></p>
<p><span style="color: #ff0000;">def getTranslatedMessage(mode, message, key):</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;"> if mode[0] == &#8216;d&#8217;:</span></p>
<p style="padding-left: 60px;"><span style="color: #ff0000;"> key = -key</span></p>
<p style="padding-left: 60px;"><span style="color: #ff0000;"> translated = &#8221;</span></p>
<p style="padding-left: 30px;"><span style="color: #ff0000;">for symbol in message:</span></p>
<p style="padding-left: 60px;"><span style="color: #ff0000;"> if symbol.isalpha():</span></p>
<p style="padding-left: 90px;"><span style="color: #ff0000;"> num = ord(symbol)</span></p>
<p style="padding-left: 90px;"><span style="color: #ff0000;"> num += key</span></p>
<p style="padding-left: 60px;"><span style="color: #ff0000;">if symbol.isupper():</span></p>
<p style="padding-left: 90px;"><span style="color: #ff0000;"> if num &gt; ord(&#8216;Z&#8217;):</span></p>
<p style="padding-left: 120px;"><span style="color: #ff0000;"> num -= 26</span></p>
<p style="padding-left: 90px;"><span style="color: #ff0000;"> elif num &lt; ord(&#8216;A&#8217;):</span></p>
<p style="padding-left: 120px;"><span style="color: #ff0000;"> num += 26</span></p>
<p style="padding-left: 90px;"><span style="color: #ff0000;"> elif symbol.islower():</span></p>
<p style="padding-left: 120px;"><span style="color: #ff0000;">if num &gt; ord(&#8216;z&#8217;):</span></p>
<p style="padding-left: 150px;"><span style="color: #ff0000;"> num -= 26</span></p>
<p style="padding-left: 120px;"><span style="color: #ff0000;">elif num &lt; ord(&#8216;a&#8217;):</span></p>
<p style="padding-left: 150px;"><span style="color: #ff0000;"> num += 26</span></p>
<p style="padding-left: 150px;"><span style="color: #ff0000;">translated += chr(num)</span></p>
<p style="padding-left: 120px;"><span style="color: #ff0000;"> else:</span></p>
<p style="padding-left: 150px;"><span style="color: #ff0000;"> translated += symbol</span></p>
<p style="padding-left: 150px;"><span style="color: #ff0000;">return translated</span></p>
<p><span style="color: #ff0000;">mode = getMode()</span></p>
<p><span style="color: #ff0000;">message = getMessage()</span></p>
<p><span style="color: #ff0000;">key = getKey()</span></p>
<p><span style="color: #ff0000;"><br />
</span></p>
<p><span style="color: #ff0000;">print &#8216;Your translated text is:&#8217;</span></p>
<p><span style="color: #ff0000;">print getTranslatedMessage(mode, message, key)</span></p>
<p><span style="color: #ff0000;">input()</span></p>
<p>You can check out the code for finding out root of a number using<a href="http://techyoyo.com/2009/08/first-python-program-newton-square-root/"> Newton&#8217;s method of iteration in Python</a>. This code cipher code is from the free ebook <a href="http://pythonbook.coffeeghost.net/" target="_blank">Invent Your Own Computer Games with Python</a></p>
<script type="text/javascript" src="http://cdn.socialtwist.com/2009071621213/script.js"></script><a class="st-taf" href="http://tellafriend.socialtwist.com:80" onclick="return false;" style="border:0;padding:0;margin:0;"><img alt="SocialTwist Tell-a-Friend" style="border:0;padding:0;margin:0;" src="http://images.socialtwist.com/2009071621213/button.png"onmouseout="STTAFFUNC.hideHoverMap(this)" onmouseover="STTAFFUNC.showHoverMap(this, '2009071621213', 'http%3A%2F%2Ftechyoyo.com%2F2009%2F08%2Fencrypt-message-python-programming-language%2F', 'Encrypt+message+using+Python')" onclick="STTAFFUNC.cw(this, {id:'2009071621213', link: 'http%3A%2F%2Ftechyoyo.com%2F2009%2F08%2Fencrypt-message-python-programming-language%2F', title: 'Encrypt+message+using+Python' });"/></a>]]></content:encoded>
			<wfw:commentRss>http://techyoyo.com/2009/08/encrypt-message-python-programming-language/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My first real Python program</title>
		<link>http://techyoyo.com/2009/08/first-python-program-newton-square-root/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=first-python-program-newton-square-root</link>
		<comments>http://techyoyo.com/2009/08/first-python-program-newton-square-root/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 16:51:05 +0000</pubDate>
		<dc:creator>arun kamath</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://techyoyo.com/?p=76</guid>
		<description><![CDATA[I am really beginning to like Python Programming Language. It is quite efficient in doing lot of tasks. Unfortunately, I don&#8217;t get to devote much time for learning it. Here is the code that will calculate the square root by newton method of iterations. import random a = float(raw_input(&#8220;enter a integer&#8221;)) x = random.randint(1,a-1) while [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechyoyo.com%2F2009%2F08%2Ffirst-python-program-newton-square-root%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechyoyo.com%2F2009%2F08%2Ffirst-python-program-newton-square-root%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I am really beginning to like Python Programming Language. It is quite efficient in doing lot of tasks. Unfortunately, I don&#8217;t get to devote much time for learning it. Here is the code that will calculate the square root by newton method of iterations.</p>
<p><span style="color: #ff0000;">import random</span></p>
<p><span style="color: #ff0000;">a = float(raw_input(&#8220;enter a integer&#8221;))</span></p>
<p><span style="color: #ff0000;">x = random.randint(1,a-1)</span></p>
<p><span style="color: #ff0000;">while True:</span></p>
<p style="padding-left: 30px;"><span style="white-space: pre;"><span style="color: #ff0000;"> </span></span><span style="color: #ff0000;">print x</span></p>
<p style="padding-left: 30px;"><span style="white-space: pre;"><span style="color: #ff0000;"> </span></span><span style="color: #ff0000;">y = (x + a/x) / 2</span></p>
<p style="padding-left: 30px;"><span style="white-space: pre;"><span style="color: #ff0000;"> </span></span><span style="color: #ff0000;">if y == x:</span></p>
<p style="padding-left: 60px;"><span style="white-space: pre;"><span style="color: #ff0000;"> </span></span><span style="color: #ff0000;">break</span></p>
<p style="padding-left: 30px;"><span style="white-space: pre;"><span style="color: #ff0000;"> </span></span><span style="color: #ff0000;">x = y</span></p>
<p><span style="color: #ff0000;">raw_input()</span></p>
<div>The &#8216;raw_input()&#8217; on last line has been used as an equivalent to &#8216;getch()&#8217; of C.  The only problem with this code is that it will not accept floating numbers. What should I to make it compute even floating numbers? Please write in the comment section.</div>
<div>Here is my post about<a href="http://techyoyo.com/2009/06/decided-learn-python-programming-language/" target="_self"> Why I decided to learn Python</a>.</div>
<div>If you know about any good e-book about python please tell me in the comments section.</div>
<script type="text/javascript" src="http://cdn.socialtwist.com/2009071621213/script.js"></script><a class="st-taf" href="http://tellafriend.socialtwist.com:80" onclick="return false;" style="border:0;padding:0;margin:0;"><img alt="SocialTwist Tell-a-Friend" style="border:0;padding:0;margin:0;" src="http://images.socialtwist.com/2009071621213/button.png"onmouseout="STTAFFUNC.hideHoverMap(this)" onmouseover="STTAFFUNC.showHoverMap(this, '2009071621213', 'http%3A%2F%2Ftechyoyo.com%2F2009%2F08%2Ffirst-python-program-newton-square-root%2F', 'My+first+real+Python+program')" onclick="STTAFFUNC.cw(this, {id:'2009071621213', link: 'http%3A%2F%2Ftechyoyo.com%2F2009%2F08%2Ffirst-python-program-newton-square-root%2F', title: 'My+first+real+Python+program' });"/></a>]]></content:encoded>
			<wfw:commentRss>http://techyoyo.com/2009/08/first-python-program-newton-square-root/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Why I decided to learn Python</title>
		<link>http://techyoyo.com/2009/06/decided-learn-python-programming-language/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=decided-learn-python-programming-language</link>
		<comments>http://techyoyo.com/2009/06/decided-learn-python-programming-language/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 13:54:20 +0000</pubDate>
		<dc:creator>arun kamath</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://techyoyo.com/?p=24</guid>
		<description><![CDATA[I am a BSc IT student of Mumbai university. We don&#8217;t actually have to learn Python Programming language. Also you know that in India the fad is to learn Java, .NET, VB, etc. So why did I chose to learn Python? Firstly, I was impressed when I came to know that Google&#8217;s algorithms are based [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ftechyoyo.com%2F2009%2F06%2Fdecided-learn-python-programming-language%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ftechyoyo.com%2F2009%2F06%2Fdecided-learn-python-programming-language%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I am a BSc IT student of Mumbai university. We don&#8217;t actually have to learn Python Programming language. Also you know that in India the fad is to learn Java, .NET, VB, etc. So why did I chose to learn Python?</p>
<p>Firstly, I was impressed when I came to know that Google&#8217;s algorithms are based on Python. NASA also uses it for various purposes.</p>
<p>But what really turned me on was the fact that Python is very easy to learn. I probed further and got to know more about it. Here are the reasons why you must learn Python even though there is not much scope in India as of now.</p>
<ol>
<li>In Python there is no Types and Size like in C/C++. This makes programming whole lot easier.</li>
<li>Python programs are easier to undertstand. Making it useful in building large software in a team.</li>
<li>Most of the unnecessary coding is not required in Python making the programs shorter and development phase faster than any other old languages.</li>
<li>Python is portable. It will run on almost every OS without any issues. You can use Tkinter or WxPython to create GUI and it will work on all platforms. Compare this with VB which will work only in Windows.</li>
<li>Python script can call C/C++ libraries, use Java classes, integrate with .NET, etc.</li>
</ol>
<p>After learning python, I am going to learn WxPython an Jython. You can learn Python from the official documentation you will get when you <a href="http://www.python.org/download/" target="_blank">download Python</a> from Python&#8217;s website. However, I found It difficult to understand.  I found this site <a href="http://www.ibiblio.org/g2swap/byteofpython/read/index.html" target="_blank">Byte For Python</a> was better for beginners. I have also purchased O&#8217; Reilly&#8217;s <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2Fs%3Fie%3DUTF8%26x%3D0%26ref%255F%3Dnb%255Fss%255Fkinc%26y%3D0%26field-keywords%3Dpython%2520in%2520a%2520nutshell%26url%3Dsearch-alias%253Daps&amp;tag=undethesun-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=390957" target="_blank">Programming Python and Python in a Nutshell</a>.  These books are bit advanced.</p>
<script type="text/javascript" src="http://cdn.socialtwist.com/2009071621213/script.js"></script><a class="st-taf" href="http://tellafriend.socialtwist.com:80" onclick="return false;" style="border:0;padding:0;margin:0;"><img alt="SocialTwist Tell-a-Friend" style="border:0;padding:0;margin:0;" src="http://images.socialtwist.com/2009071621213/button.png"onmouseout="STTAFFUNC.hideHoverMap(this)" onmouseover="STTAFFUNC.showHoverMap(this, '2009071621213', 'http%3A%2F%2Ftechyoyo.com%2F2009%2F06%2Fdecided-learn-python-programming-language%2F', 'Why+I+decided+to+learn+Python')" onclick="STTAFFUNC.cw(this, {id:'2009071621213', link: 'http%3A%2F%2Ftechyoyo.com%2F2009%2F06%2Fdecided-learn-python-programming-language%2F', title: 'Why+I+decided+to+learn+Python' });"/></a>]]></content:encoded>
			<wfw:commentRss>http://techyoyo.com/2009/06/decided-learn-python-programming-language/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
