tag:blogger.com,1999:blog-74314447516255270972024-03-06T00:36:44.374-08:00ThecodingprojectSatyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.comBlogger26125tag:blogger.com,1999:blog-7431444751625527097.post-39139475738148846592017-10-20T08:12:00.000-07:002017-10-20T08:12:12.828-07:00What I learned from writing a guest post<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: left;">
<a href="https://1.bp.blogspot.com/mkRp8QnpU54oibdoTWNM-0CQkg7ObtVskHsDuTuKNtZiPjG60V2_zxh8oU4ENoN0Ja6w6g=s400" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img alt="writing-article" border="0" data-original-height="400" data-original-width="257" height="320" src="https://1.bp.blogspot.com/mkRp8QnpU54oibdoTWNM-0CQkg7ObtVskHsDuTuKNtZiPjG60V2_zxh8oU4ENoN0Ja6w6g=s400" title="writing article" width="205" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
Recently I wrote a python tutorial for <a href="http://www.datacamp.com/community/tutorials/loops-python-tutorial" target="_blank">Datacamp</a>, while writing this tutorial I learned a couple of things which I am going to share with you right here in my blog post. May be you can use my experiences in your own endeavours as a writer.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<h3 style="clear: both; text-align: left;">
<span style="color: dodgerblue;">Idea</span></h3>
<a href="https://1.bp.blogspot.com/mozv1j3WUKFSbHZd18u0yIa73rx8U_J31ckWFZXqZnopJ7K6SmGfOLDSOEsptG1vValcLA=s400" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" data-original-height="400" data-original-width="257" height="320" src="https://1.bp.blogspot.com/mozv1j3WUKFSbHZd18u0yIa73rx8U_J31ckWFZXqZnopJ7K6SmGfOLDSOEsptG1vValcLA=s400" width="205" /></a>The first step is idea generation. You can either search through any previous topics in your blog post if you have one or you can go through your past learning, experiences or any problem statement that you might have gone through and you will find that while doing that you can get tons of ideas to start your article. If you fall short of ideas then you can ask for help from may be your social media followings your friends or your family, for example I asked the people at <a href="http://www.datacamp.com/community/tutorials/loops-python-tutorial" target="_blank">Datacamp</a> themselves and they suggested me a couple of topics which got me started on the right note. So, be prompt to ask for help and you will be surprised how easily you can crowd-source ideas and there's nothing wrong in it.<br />
<br />
<h3 style="text-align: left;">
<span style="color: dodgerblue;">Squeezing in time</span></h3>
<a href="https://1.bp.blogspot.com/SiCaZA4tdrfEOjxDr529w0c66zgJidTRyzssr_HV-BpkQLyqlWh7ugvzSkgbOrtjS1W4Vw=s400" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="400" data-original-width="257" height="320" src="https://1.bp.blogspot.com/SiCaZA4tdrfEOjxDr529w0c66zgJidTRyzssr_HV-BpkQLyqlWh7ugvzSkgbOrtjS1W4Vw=s400" width="204" /></a><br />
<br />
<div>
Squeezing in time to get into a side project while handling a full time job is a nagging difficulty for most of us and if you are like me who works on multiple side projects then this seems next to impossible, right? Wrong, Actually you have to squeeze in your side project whenever and wherever you can. For instance while writing the python tutorial for Datacamp I was actually working on two more side projects while holding a full time job, so what I did was that I squeezed in my task of tutorial writing whenever I could, if I had time after dinner I wrote a few lines for the tutorial, if I had some time left in between watching my favourite TV show then I devoted the couple of free minutes to write some few more lines of codes for the python tutorial. In short you have time and lots of it, its just a question of how efficiently you can manage it. </div>
<h3 style="clear: both; text-align: left;">
<span style="color: dodgerblue;">The Review</span></h3>
<div>
<a href="https://2.bp.blogspot.com/enSxqrCAmp4t992U2SJk7gZUVwOu_W-l081nosjapS2wH28vl6dai1E1siqVIqzT7prZpg=s400" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" data-original-height="400" data-original-width="257" height="200" src="https://2.bp.blogspot.com/enSxqrCAmp4t992U2SJk7gZUVwOu_W-l081nosjapS2wH28vl6dai1E1siqVIqzT7prZpg=s400" width="126" /></a>Tidying up your work before submitting your final piece is very important as it reduces the overhead of the people who will actually take care of editing and publishing your article. I myself did many mistake during my first article but now I have made it a point to double check each and every line of my writing or code before submitting it for a final review.<br />
<br />
<br />
<h3 style="text-align: left;">
<span style="color: dodgerblue;">Go ahead and get writing</span></h3>
</div>
<div>
I have tried to note down my learning/experiences and I hope that you all can take home something from these experiences of mine and believe me the more you write and contribute to the community the more you will learn yourself and the more satisfaction you will get as you are able to help the community. So go ahead and start writing.<br />
<br />
<i>If you want to read through the my python tutorial and learn how to use python loops then visit the link here at <a href="http://www.datacamp.com/community/tutorials/loops-python-tutorial" target="_blank">Datacamp</a> . </i></div>
<div>
<span style="color: dodgerblue;"><br />
</span><br />
<span style="color: dodgerblue;"><br /></span>
<i>If you like my work helps you in learning what you want then you can help me keep this blog running by donating me on <a href="https://ko-fi.com/A5533OZ0" target="_blank"><img alt="Buy Me a Coffee at ko-fi.com" border="0" height="36" src="https://az743702.vo.msecnd.net/cdn/kofi2.png?v=0" style="border: 0px; height: 36px;" /></a> or supporting me on @<a href="http://buy%20me%20a%20coffee%20at%20ko-fi.com/" target="_blank">Patreon </a></i><br />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Subscribe to my youtube </span><a href="https://goo.gl/iYQAnn" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">channel</span></a><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;"> to watch the coding in this tutorial in action</span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<span style="color: dodgerblue;"></span><br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="color: black; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
</div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-26147770550349562322017-09-09T00:02:00.001-07:002017-11-29T05:38:23.971-08:00How To Install Tensorflow On Windows<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvMWqTsyP_LK9-eJiVqGbs_tU9lN8R5n1__G4tg83zU-r9JV0eNGv_z0IXZaBubodpv2mw-MzvOHhQHx6kWDu9BRNEqmvhh2LEImGzsJkt11JYHpsRn4neo1sj0rGCjEpBoK02whApu9Xy/s1600/tensorflow_install.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="387" data-original-width="688" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvMWqTsyP_LK9-eJiVqGbs_tU9lN8R5n1__G4tg83zU-r9JV0eNGv_z0IXZaBubodpv2mw-MzvOHhQHx6kWDu9BRNEqmvhh2LEImGzsJkt11JYHpsRn4neo1sj0rGCjEpBoK02whApu9Xy/s320/tensorflow_install.jpg" width="320" /></a></div>
<h2 id="-Why I am writing this tutorial ?-" style="background-color: white; box-sizing: border-box; color: dodgerblue; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 21.994px; line-height: 1; margin: 0.636em 0px 0px;">
</h2>
<h2 id="-Why I am writing this tutorial ?-" style="background-color: white; box-sizing: border-box; color: dodgerblue; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 21.994px; line-height: 1; margin: 0.636em 0px 0px;">
Why I am writing this tutorial ?</h2>
</div>
<div>
<br /></div>
Recently I have started learning machine learning specifically DeepLearning for one of my pet projects, and during this quest of mine I wanted to learn TensorFlow library which is developed by Google. Learning is one thing but first I needed to install the library, but there was this problem which I faced during the installation. I am using Anaconda as my package manager and trying to install the Tensorflow library on my work computer which is behind a proxy, installing directly from the anaconda cloud while behind a proxy always displayed a proxy error.<br />
<div>
<br /></div>
<div>
How did I resolve the issue? Well this is exactly what I am going to write down in the below tutorial.</div>
<div>
<h2 id="-The Steps to Follow-" style="background-color: white; box-sizing: border-box; color: dodgerblue; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 21.994px; line-height: 1; margin: 0.636em 0px 0px;">
The Steps To Follow</h2>
</div>
<div>
<br /></div>
<div>
Before we get all cosy with this short tutorial on Tensorflow installation, let me tell you that<br />
this tutorial is on the assumption that you have already installed Anaconda on your machine and you know at least a few basic things or two about python.<br />
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<blockquote>
If you want to learn basic python before getting started with this tutorial then you can read my <a href="https://goo.gl/WXtYbK" target="_blank">Beginners Python Tutorial</a> or you can watch the Tutorial on my <a href="https://goo.gl/iYQAnn" target="_blank">Youtube channel</a>. </blockquote>
<iframe frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ac&ref=tf_til&ad_type=product_link&tracking_id=sapal603-20&marketplace=amazon&region=US&placement=1593275994&asins=1593275994&linkId=95ac33ab00ebb34fd804119d2ea9dd8e&show_border=true&link_opens_in_new_window=true&price_color=333333&title_color=0066c0&bg_color=ffffff" style="height: 240px; width: 120px;"><br />
</iframe><br /></div>
</div>
First you need to download the Tensorflow tar file from the Anaconda cloud from <a href="https://anaconda.org/conda-forge/tensorflow/files" target="_blank">here</a> . You will need to download the file named as "<span style="color: #3a9724; font-family: "proxima nova" , "lato" , "helvetica neue" , "helvetica" , "roboto" , "arial" , sans-serif;"><span style="background-color: #f4f7f9; box-sizing: border-box; cursor: pointer; font-size: 14px; line-height: inherit; outline-color: initial; outline-style: initial;">win-64/tensorflow-1.3.0-py36_0.tar.bz2</span></span>" . Additionally you will also have to download "repodata.json.bz2" from <a href="https://conda.anaconda.org/conda-forge/win-64/repodata.json.bz2" target="_blank">here</a> .<br />
<br />
Update : 11/28/17 - As pointed out by one of my fellow machine learning enthusiast from my workplace Martin Uribe (<i>You can visit his github profile <a href="https://github.com/clamytoe" target="_blank">here</a></i>) I missed the download link for the "protobuf" package earlier. So here is the <a href="https://anaconda.org/anaconda/protobuf/files?sort=length&sort_order=desc" target="_blank">link</a>.</div>
<br />
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<blockquote>
If you want to know what is contained in the <strong>repodata.json.bz2</strong> file and why is it important then you can head over to the <a href="https://conda.io/docs/user-guide/tasks/build-packages/package-spec.html" target="_blank">Anaconda website</a> where you can get a detailed description of this file.</blockquote>
Then Open the anaconda prompt and navigate to the folder where the above files are downloaded e.g. C:\Users\thecodingproject\Downloads and run the below commands.<br />
<script src="https://gist.github.com/sapal6/1ccd898407a2bbf264b2ec7adb2b04c7.js"></script><br /></div>
</div>
</div>
<div>
<h2 id="-Validating Your Installation-" style="background-color: white; box-sizing: border-box; color: dodgerblue; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 21.994px; line-height: 1; margin: 0.636em 0px 0px;">
Validating Your Installation</h2>
</div>
<div>
<br />
Now that you are goody goody with your shiny new Tensorflow installation , It's time to test it. To test the installation use the below short program in the same anaconda terminal -<br />
<script src="https://gist.github.com/sapal6/3d887dc53107dea4f3bc8f88974844c0.js"></script><br />
If you get an output resembling the below output then you are all sorted.<br />
<script src="https://gist.github.com/sapal6/9c16acd09e16430e334dd04a41d121e5.js"></script><br /></div>
If you like my work helps you in learning what you want then you can help me keep this blog running by donating me on <a href="https://ko-fi.com/A5533OZ0" target="_blank"><img alt="Buy Me a Coffee at ko-fi.com" border="0" height="36" src="https://az743702.vo.msecnd.net/cdn/kofi2.png?v=0" style="border: 0px; height: 36px;" /></a> or supporting me on @<a href="http://buy%20me%20a%20coffee%20at%20ko-fi.com/" target="_blank">Patreon </a><br />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Subscribe to my youtube </span><a href="https://goo.gl/iYQAnn" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">channel</span></a><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;"> to watch the coding in this tutorial in action</span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="color: black; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<br /></div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-50076268075272499132017-08-28T01:50:00.001-07:002017-09-02T03:24:05.802-07:00For Loop in python 3 : How to become a Python Jedi - Beginners Python Programming Tutorial - Part 7 <div dir="ltr" style="text-align: left;" trbidi="on">
<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/ZqWaa-9mW_w" width="560"></iframe><br />
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"><br />
</span> <span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;">I am back again with another part in the beginner python programming tutorial series. We will continue with "Loops" but this time we are going to learn how to use for loop in python 3. </span><br />
<span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"><br />
</span> <br />
<h2 id="-Difference-between-For-loop-and-While-Loop-" style="background-color: white; box-sizing: border-box; color: dodgerblue; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 21.994px; line-height: 1; margin: 0.636em 0px 0px;">
Difference between For loop and While Loop</h2>
<div>
<br /></div>
<div>
<span style="background-color: white;"><span style="font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;">A "For Loop" and "While Loop" have a common connection that both are looping statement, but major difference is that unlike while loop, a for loop gets executed a specified number of times.</span></span></span></div>
<div>
<span style="background-color: white;"><span style="font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;"><br />
</span></span></span></div>
</div>
<!--amazon ad--><br />
<script type="text/javascript">
amzn_assoc_placement = "adunit0";
amzn_assoc_tracking_id = "sapal603-20";
amzn_assoc_ad_mode = "search";
amzn_assoc_ad_type = "smart";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_title = "Shop Related Products";
amzn_assoc_default_search_phrase = "Python books";
amzn_assoc_default_category = "Books";
amzn_assoc_linkid = "af79d2d1612cc66aa37025571c19568e";
amzn_assoc_search_bar = "true";
amzn_assoc_search_bar_position = "top";
amzn_assoc_default_browse_node = "283155";
</script><br />
<script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script><br />
<div style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 1em;">
We can break down the For loop into the following components(Refer to the for loop flow chart below).</div>
<noscript><a href="https://yllix.com/publishers/816522" target="_blank"><img src="//ylx-aff.advertica-cdn.com/pub_0ei6v1.png" border="0" /></a></noscript><br />
<ul style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; list-style-image: initial; list-style-position: initial; margin-bottom: 9px; margin-top: 1em; padding-left: 2em;">
<li style="box-sizing: border-box;">for keyword</li>
<li style="box-sizing: border-box;">variable name</li>
<li style="box-sizing: border-box;">call to the range function</li>
<li style="box-sizing: border-box;">colon operator</li>
<li style="box-sizing: border-box;">clause or block of code</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinUMvScRdsC1BX5RNGG4v82_FcvOY6PjU3d5XN6bD7lRvBBTEh9RUmKcKBEWBK29vtTYA1p4zKSxp0eQ2qqmahEYRG6CxZ-VUSENcHFvJoG7GNqiVy-91mg6LA5OlYzB1zzqzxP7qqk2jA/s1600/while+loop+flowchart.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="for-loop-flow-chart" border="0" data-original-height="370" data-original-width="545" height="217" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinUMvScRdsC1BX5RNGG4v82_FcvOY6PjU3d5XN6bD7lRvBBTEh9RUmKcKBEWBK29vtTYA1p4zKSxp0eQ2qqmahEYRG6CxZ-VUSENcHFvJoG7GNqiVy-91mg6LA5OlYzB1zzqzxP7qqk2jA/s320/while+loop+flowchart.png" title="for loop flow chart" width="320" /></a></div>
<div>
<h2 id="-Hovering-over-the-flow-chart" style="background-color: white; box-sizing: border-box; color: dodgerblue; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 21.994px; line-height: 1; margin: 0.636em 0px 0px;">
Hovering over the flow-chart</h2>
</div>
<div>
<br /></div>
<div>
<span style="background-color: white;"><span style="font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;">The above flow-chart is..well horrible I know, but I make my own drawings because I can't afford an artist. So, bear with me. In the above flowchart is a very basicy, laymanish representation of a for loop. The decision box contains the </span></span></span><strong style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">For</strong><span style="background-color: white;"><span style="font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;"> statement along-with it's soulmate i.e the </span></span></span><strong style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">Range</strong><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"> function. As long as the variable </span><strong style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">I</strong><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"> falls within the range </span><strong style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">x</strong><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"> then the control flows down to the underlying code and it continues in the loop till the time </span><strong style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">I</strong><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"> is less than </span><strong style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">x</strong><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;">.</span></div>
<div>
<span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"><br />
</span></div>
<div>
<h2 id="-Digging-deeper-down" style="background-color: white; box-sizing: border-box; color: dodgerblue; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 21.994px; line-height: 1; margin: 0.636em 0px 0px;">
Digging deeper down</h2>
</div>
<!--amazon ad--><br />
<iframe frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ac&ref=tf_til&ad_type=product_link&tracking_id=sapal603-20&marketplace=amazon&region=US&placement=1593276036&asins=1593276036&linkId=36da25d75fe12259b2aecbad409519a5&show_border=false&link_opens_in_new_window=false&price_color=333333&title_color=0066C0&bg_color=FFFFFF" style="height: 240px; width: 120px;"><br />
</iframe><br />
<div>
<br />
<br /></div>
<div>
<strong 14px="" arial="" font-size:="" helvetica="" neue="" sans-serif="" style="background-color: white; box-sizing: border-box;">We will formulate a simple code to understand how to implement the concept we learned above</strong></div>
<div>
<br /></div>
</div>
<iframe allowfullscreen="" frameborder="0" height="356" marginheight="0" marginwidth="0" src="https://trinket.io/embed/python3/24b3118dd5?runOption=console&start=result" width="100%"></iframe><br />
<br />
<div class="cell text_cell unselected rendered" style="border-color: transparent; border-radius: 2px; border-style: solid; border-width: 1px; box-sizing: border-box; display: flex; margin: 0px; outline: none; overflow: visible; padding: 5px; position: relative; width: 1110px;" tabindex="2">
<div class="inner_cell" style="-webkit-box-align: stretch; -webkit-box-flex: 1; -webkit-box-orient: vertical; align-items: stretch; box-sizing: border-box; display: flex; flex-direction: column; flex: 1 1 0%; min-width: 0px;">
<div class="text_cell_render rendered_html" style="border-style: none; box-sizing: border-box; outline: none; overflow-x: auto; overflow-y: hidden; padding: 0.5em 0.5em 0.5em 0.4em; resize: none; width: inherit;" tabindex="-1">
<div style="box-sizing: border-box; font-family: "helvetica neue", helvetica, arial, sans-serif; font-size: 14px;">
<strong style="box-sizing: border-box;">Run the above code and the output shall be</strong></div>
<div style="box-sizing: border-box; margin-top: 1em;">
<div style="font-family: "helvetica neue", helvetica, arial, sans-serif; font-size: 14px;">
I will draw better flowcharts from next time</div>
<div style="font-family: "helvetica neue", helvetica, arial, sans-serif; font-size: 14px;">
I will draw better flowcharts from next time</div>
<div style="font-family: "helvetica neue", helvetica, arial, sans-serif; font-size: 14px;">
I will draw better flowcharts from next time</div>
<div style="font-family: "helvetica neue", helvetica, arial, sans-serif; font-size: 14px;">
<br /></div>
<span style="background-color: white;"><span style="font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;">Now how exactly the above code works? It's simple, the control goes to the for statement where it sets an</span></span></span><br />
<span style="background-color: white;"><span style="font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;">initial value of </span></span></span><strong style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">0</strong><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"> to the variable </span><strong style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">i</strong><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;">, then it checks if this value is less than the value within the range function. </span><br />
<span style="background-color: white;"><span style="font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;">Which in our case resolves to true so the control moves to the print statement and then prints the statement </span></span></span><br />
<span style="font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;">within</span></span><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"> it and then immediately increments the value of </span><strong style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">i</strong><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"> by 1, after which the control again moves to the for </span><br />
<div style="font-family: "helvetica neue", helvetica, arial, sans-serif; font-size: 14px;">
<span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;">statement. This process continues till the value of i is less then the value within the range function. Once the </span></div>
<div style="font-family: "helvetica neue", helvetica, arial, sans-serif; font-size: 14px;">
<span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;">value is equal to the range function ,the control exists the loop.</span></div>
<div style="font-family: "helvetica neue", helvetica, arial, sans-serif; font-size: 14px;">
<br /></div>
</div>
</div>
</div>
</div>
</div>
<h2 id="-Something-more-from-the-Range()" style="background-color: white; box-sizing: border-box; color: dodgerblue; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 21.994px; line-height: 1; margin: 0.636em 0px 0px;">
Something more from the Range()</h2>
<div>
<br /></div>
<div>
<span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;">Now you must be wanting more from the Range() function rather then just handling the range, maybe some more customisation. </span><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"> </span><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;">I don't blame you, it's</span><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"> </span><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;">human nature to want more, we are never satisfied with less. Looking into this </span><span style="background-color: white;"><span style="font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;">the good guys at python have imparted some more room for customisation in</span></span></span><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"> </span><span style="background-color: white;"><span style="font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;">the Range function and this we shall see in the below code.</span></span></span></div>
<div>
</div>
</div>
<br />
<iframe allowfullscreen="" frameborder="0" height="356" marginheight="0" marginwidth="0" src="https://trinket.io/embed/python3/146153c893?start=result" width="100%"></iframe><br />
<br />
<span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;">In our above code snippet everything is same as the previous example but this time we have introduced a start position </span><strong style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">1</strong><span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"> which is known as the step-in and an end position </span><strong style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">3</strong><span style="background-color: white;"><span style="font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;"><span style="font-size: 14px;"> which is known as the step-out. What it means is that the control enter the loop when the index is at the count-1 and exists the loop when the index is at count-2 and because of this the statement is printed only 2 times instead of 3.</span></span></span><br />
<br /></div>
<span style="background-color: white; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;"></span><br />
<h2 id="-Something-more-from-the-Range()" style="background-color: white; box-sizing: border-box; color: dodgerblue; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 21.994px; line-height: 1; margin: 0.636em 0px 0px;">
Conclusion</h2>
<div>
<br /></div>
<div>
Now I must say that we have just scratched the surface for loops in python, but if you are in a mood to make a deeper dive into understand the loops in details then you should definitely go for this book <a href="about:invalid#zClosurez"></a><a href="https://www.amazon.com/gp/product/1593275994/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1593275994&linkCode=as2&tag=sapal603-20&linkId=5be5be332505da18dc41cf5dd5af3654" target="_blank">Automate the Boring Stuff with Python: Practical Programming for Total Beginners</a><img alt="" border="0" height="1" src="//ir-na.amazon-adsystem.com/e/ir?t=sapal603-20&l=am2&o=1&a=1593275994" style="border: none !important; margin: 0px !important;" width="1" /> . I started my coding journey with this book and I believe you would get something out of it too.<br />
<br />
This was all for today but before signing off I would like to thank you all for the love that you guys have shown me. I am overwhelmed by the daily visits that I get on my blog and my <a href="https://goo.gl/iYQAnn">youtube channel.</a><br />
<br />
I work hard to create and share programming tutorials and stuffs on my blog and <a href="https://goo.gl/iYQAnn">youtube channel </a>. It's my sole motive to help you learn coding by sharing my knowledge and experiences that I have gained during my own journeys. All my contents are absolutely free but a nice hot cup of coffee from you would be great to get me going. Now it's perfectly fine if you don't want to buy me a coffee, you can just stop by to say hello.<br />
<br />
If you like my work and it helps you in learning what you want then you can buy me a coffee by clicking on the below button.</div>
<div>
<br /></div>
</div>
<center>
<a href="https://ko-fi.com/A5533OZ0" target="_blank"><img alt="Buy Me a Coffee at ko-fi.com" border="0" height="36" src="https://az743702.vo.msecnd.net/cdn/kofi1.png?v=0" style="border: 0px; height: 36px;" /></a></center>
<center>
</center>
<center style="text-align: left;">
<a href="https://goo.gl/m15Vtw"><span style="font-family: "comic sans ms"; font-size: small; white-space: pre-wrap;"><span style="white-space: normal;">Take me to Python Tutorial - Part </span></span><span style="font-family: comic sans ms;"><span style="font-size: 18.6667px; white-space: pre-wrap;">6</span></span><span style="font-family: "comic sans ms"; font-size: 18.6667px; white-space: pre-wrap;"> </span></a> <b>To Be Continued<span style="font-family: "comic sans ms"; font-size: 18.6667px;"><span style="white-space: pre-wrap;"> ....</span></span></b></center>
</div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-79009638625616263832017-08-26T14:31:00.001-07:002017-08-26T14:32:02.128-07:00Buy me a coffee<div dir="ltr" style="text-align: left;" trbidi="on">Hey fiends thanks for the love that you guys have shown me. I am overwhelmed by the daily visits that I get on my blow and my youtube channel.<br />
<br />
I usually work at night to create and share programming tutorials and stuffs on my blog thecodingproject.blogspot.com & youtube channel https://goo.gl/iYQAnn . A nice hot cup of coffee from you would be great to get me going. Now it's perfectly fine if you don't want to buy me a coffee, you can just stop by to say hello.<br />
<br />
<center><a href='https://ko-fi.com/A5533OZ0' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a></center></div>Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-34226957090755679732017-08-14T03:31:00.000-07:002017-10-12T03:22:58.888-07:00Collatz sequence python : Monday fun with Python<div dir="ltr" style="text-align: left;" trbidi="on">
Hello everyone. Today is Monday..well not a big deal and I know everyone knows today is a Monday. Like you I'm not a big fan of Monday, although nowadays I'm waiting eagerly for this day of the week as I get to watch a Game of Thrones episode on this day and I'm sure most of you can reciprocate the same feeling. The only thing I hate the most is the long wait till Monday night till I return to home from office and get to watch that episode for which I wait for one whole week and here I am in office waiting for the day to get over soon.<br />
<br />
<h2 style="text-align: left;">
<u><span style="color: #3d85c6;">The plan</span></u></h2>
To kill the time I do one of the thing that I love the most. Yes, you guessed right? I code. So, I decided to fool around some python programming code to kill the boredom. Without much ado let's code :) I decided to device a python program that would help me to devise a "collatz sequence" In case you are thinking what a "collatz sequence" is then dive into this link <a href="https://en.wikipedia.org/wiki/Collatz_conjecture">here</a>.<br />
<!--yllix ad--><br />
<div style="text-align: left;">
<span style="font-size: x-small;">For more understanding on python check the</span> <a href="http://amzn.to/2wsG2pi"><span style="color: #c45500; font-family: "amazon ember" , "arial" , sans-serif;"><span style="background-color: #f8f8f8; box-sizing: border-box; cursor: pointer; font-size: 13px; outline-color: initial; outline-style: initial; text-align: center;">Automate the Boring Stuff with Python: Practical Programming for Total Beginners</span></span><img alt="" border="0" height="1" src="https://ir-na.amazon-adsystem.com/e/ir?t=sapal603-20&l=am2&o=1&a=1593275994" style="background-color: #f8f8f8; border: none !important; box-sizing: border-box; color: #111111; font-family: "Amazon Ember", Arial, sans-serif; font-size: 13px; margin: 0px !important; max-width: 100%; text-align: center; vertical-align: top;" width="1" /> </a><br />
<iframe frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ac&ref=tf_til&ad_type=product_link&tracking_id=mobile-popover0b-20&marketplace=amazon&region=US&placement=1593275994&asins=1593275994&linkId=8d48a789d4bb89f77ccfe7f24b377ce0&show_border=true&link_opens_in_new_window=true&price_color=333333&title_color=0066c0&bg_color=ffffff" style="height: 240px; width: 120px;"><br />
</iframe><br /></div>
<h2 style="text-align: left;">
<u><span style="color: #3d85c6;">The code</span></u></h2>
<div>
The below function is collatz() has one parameter named number. If number is even, then collatz() should print number // 2 . If number is odd, then collatz() should print and return 3 * number + 1.</div>
<div>
<br /></div>
<div>
The below program let's user provide an integer and the program then keeps calling the function collatz() till the function returns 1. It's a simple program but trust me it's very interesting, the reason why it's interesting can be found in the <a href="https://en.wikipedia.org/wiki/Collatz_conjecture">link</a> . Go ahead and have some fun and thank me later.<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="600" marginheight="0" marginwidth="0" src="https://trinket.io/embed/python/78bfaae84e?start=result" width="100%"></iframe><br />
<br />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Subscribe to my youtube </span><a href="https://goo.gl/iYQAnn" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">channel</span></a><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;"> to watch the coding in this tutorial in action</span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="color: black; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">.</span><br />
<span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">[Update] - 05/10/17 - The above program had a bug dues to which it was not functioning properly which is corrected now.</span></div>
</div>
<div>
<br /></div>
<div>
<br /></div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-86594706063017633222017-08-04T01:51:00.002-07:002017-08-04T01:51:37.889-07:00Where are the new Python Blogs?<div dir="ltr" style="text-align: left;" trbidi="on">
Hello friends I welcome you back after a long long time. It's been nearly 3 weeks since I have posted any blog post here or any new tutorial videos on my youtube channel. Recently I have been involved in many of my pet projects. One of them being studying machine learning, I am a geek at heart and I love to learn new tech things and machine learning is one that ha got me hooked and this is the reason I am spending most of my time studying ML. Meanwhile I am also trying to learn and android development and trying to build an app on my own which is again a totally new field for me and it's taking up a very large chunk of my time not to mention my full time job.<br />
<br />
Then there's my youtube channel for which I am trying to develop the best content for you guys and doing this involves a long planning, building the content, editing the videos etc. and this take a lot of time as I am able to devote 30 mins daily at the best to my youtube content creation and that explains the very long gap at which I post blogs or videos.<br />
<br />
Oh, there is another thing . I have kind of outgrown blogger in terms of creative freedom so I am also trying to put together a website for you all (like minded geeks like me). This again takes lots of learning as I am not from a coding background and whatever time I am left with after devoting to the above mentioned projects/full time job etc. I use to learn the skills of the trade and put together my website. So in short I want to say that do stay along with me for a while as I haven't disappeared completely, I will be back soon enough.</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-54481471929136552202017-07-05T17:48:00.001-07:002017-09-02T03:21:28.518-07:00While Loop in python : How to become a Python Jedi - Beginners Python Programming Tutorial - Part 6<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/eMucUcNRn3I" width="560"></iframe><br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Welcome back friends to another post on TheCodingProject and we are back with the sixth chapter of the Beginner Python programming tutorial - How to become a python Jedi. This time we are going to learn how to use while loop in python.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">The While Loop statement? </span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In Python Programming, There are 3 types of loops →</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: #666666; font-family: 'Comic Sans MS'; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #666666; font-family: "comic sans ms"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">While loop</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: #666666; font-family: 'Comic Sans MS'; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #666666; font-family: "comic sans ms"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">For loop</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: #666666; font-family: 'Comic Sans MS'; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #666666; font-family: "comic sans ms"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Nested loops</span></div>
</li>
</ul>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Now to get into some action→</span></div>
<span id="docs-internal-guid-9573599b-104d-ad06-6157-caefa9d1fae9"></span><br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-left: -5.25pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Let’s consider that two groups of aliens have landed on earth out of these two one of the group is good & the other are the bad guys. The govt. Has given you the task of designing a system that takes in input from different eyewitnesses & then classify that whether the aliens that these eyewitnesses encounter are the good guys or bad guys.<br />
</span></div>
<br />
<!--yllix ad--><br />
<a href="https://yllix.com/publishers/816522" target="_blank"><img alt="Monetize your website traffic with yX Media" border="0" height="250" src="//ylx-aff.advertica-cdn.com/pub_s9c2nm.png" title="Monetize your website traffic with yX Media" width="300" /></a><br />
<noscript><a href="https://yllix.com/publishers/816522" target="_blank"><img src="//ylx-aff.advertica-cdn.com/pub_0ei6v1.png" border="0" /></a></noscript><br />
<br />
<!--gist_code--><br />
<script src="https://gist.github.com/sapal6/85af81e9decba6702b675d8dcf05d918.js"></script><br />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-left: -5.25pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br />
</span> <br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-left: -5.25pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Copy & paste the above code in your editor and run this code. What do you get ? When the input is </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Autobots</span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> it matches the condition </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">aliens == "Autobots" </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">& it enters the loop to prints the statement pointed by the print method.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-left: -5.25pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-left: -5.25pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We can also use negative conditions for entering the while loop. Copy and paste the below code in your editor and run it→</span></div>
<br />
<!--yllix ad--><br />
<script src="//ylx-1.com/bnr.php?section=General&pub=816522&format=300x50&ga=g&mbtodb=1" type="text/javascript"></script><br />
<noscript><a href="https://yllix.com/publishers/816522" target="_blank"><img src="//ylx-aff.advertica-cdn.com/pub_0ei6v1.png" border="0" /></a></noscript><br />
<br />
<!--gist code--><br />
<script src="https://gist.github.com/sapal6/85af81e9decba6702b675d8dcf05d918.js"></script><br />
<br />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-left: -5.25pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br />
</span></div>
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br />
</span> <span id="docs-internal-guid-9573599b-1055-586c-63c3-e8d12c339e3c"></span><br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-left: -5.25pt; margin-top: 0pt;">
<span id="docs-internal-guid-9573599b-1055-586c-63c3-e8d12c339e3c"><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">As you can see the condition </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">aliens is not "Autobots" </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">resolves to False when the user inputs a wrong condition & the control enters the loop and print the statement when a false condition is returned.</span></span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-left: -5.25pt; margin-top: 0pt;">
<span id="docs-internal-guid-9573599b-1055-586c-63c3-e8d12c339e3c"><br />
</span></div>
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline;">Now let’s make our system a bit more robust by adding some extra checks into it. We shall insert an if statement inside our while loop.</span> </span><span style="font-family: "comic sans ms"; font-size: 14pt; white-space: pre-wrap;">In the version below if user gives the first input as Decepticons then the control enters the loop & prompts user for second input. Again if the input is Megatron then the control enters the if condition to print the last statement.</span></div>
<br />
<br />
<script src="https://gist.github.com/sapal6/85af81e9decba6702b675d8dcf05d918.js"></script><br />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-left: -5.25pt; margin-top: 0pt;">
<span style="font-family: "comic sans ms";"><span style="font-size: 18.6667px; white-space: pre-wrap;"><span style="font-size: 14pt;">So, folks this was all for this week but we shall return with another chapter of this tutorial with some new concepts to learn.</span></span></span><br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Subscribe to my youtube </span><a href="https://goo.gl/iYQAnn" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">channel</span></a><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;"> to watch the coding in this tutorial in action</span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="color: black; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><br />
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/xdxpEU"><span style="font-size: small;"><span style="white-space: normal;">Take me to Python Tutorial - Part </span></span>5</a> <a href="https://goo.gl/6AgtLn"> </a></span><span style="font-family: "comic sans ms"; font-size: small; white-space: pre-wrap;"><span style="white-space: normal;"><a href="https://goo.gl/6AgtLn"><span style="font-size: 18.6667px; white-space: pre-wrap;">Take me to Python Tutorial - Part </span>7</a></span></span><span style="font-family: "comic sans ms"; font-size: 14pt; white-space: pre-wrap;"> </span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
</div>
</div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-35018850436164078092017-05-28T10:47:00.001-07:002017-09-02T03:15:39.498-07:00If else in python : Beginners Python Programming Tutorial - How to become a Python Jedi - Part 5<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/T8HzdroSGOw" width="560"></iframe><br />
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span> <span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Welcome back friends to another post on TheCodingProject and we are back with the fourth chapter of the Beginner Python programming tutorial - How to become a python Jedi. This time we are going to learn about decision making in python using the If Else statement in python.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">The If-Else statement? </span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In Python Programming, decision making is done by using a conditional statement like the If-Else statement. An If statement consists of 3 parts →</span></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: #666666; font-family: 'Comic Sans MS'; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #666666; font-family: "comic sans ms"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If keyword</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: #666666; font-family: 'Comic Sans MS'; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #666666; font-family: "comic sans ms"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">a conditional operator</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: #666666; font-family: 'Comic Sans MS'; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #666666; font-family: "comic sans ms"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">the values which needs comparison</span></div>
</li>
</ul>
<span id="docs-internal-guid-cc069332-5018-4377-8f4b-c5d17d7a9453"></span><br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Now it should be kept in mind that the only values that an If condition returns are a </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">True or a False , </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Using this True or a False we can decide if the condition that we are trying check is right or wrong. </span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-weight: 400; vertical-align: baseline; white-space: pre-wrap;"><u> </u></span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-weight: 400; vertical-align: baseline; white-space: pre-wrap;"><span id="docs-internal-guid-cc069332-5018-6c0d-da68-c36f63b09215"><span style="font-size: 18pt; text-decoration-line: underline; vertical-align: baseline;"><u>When Coding knowledge came to my rescue→</u></span></span></span></div>
<div style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: left;">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-left: -5.25pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Let me tell you a story about how coding knowledge came to rescue . I have this neighbour named Alex who doesn't quite seem to be a regular guy. Wait ! actually he never seemed to me as a regular human 😟. This one day I was visiting him at his home for some work when I noticed something unusual. His living room is decorated with his family photographs, he has the photographs of his entire family tree over there starting from his great grandfather down to him. The weird thing that I noticed was that all the men in these photographs looked similar to him as if he himself was present throughout his family history. Is Alex a Vampire ? 😓 With this frightening thought in mind I ran back to my house and jumped straight to the computer and started to code. Using my superhuman brain I made a python program which would hack into his personal computer and collect all his personal information and then the program would calculate his age & use that knowledge to decide if Alex was really a Vampire. Now, that program is highly confidential so I won’t show you my entire code but as you guys are so much interested I will show you the snippet that is really pivotal in deciding Alex’s truth →</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-left: -5.25pt; margin-top: 0pt;">
</div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-left: -5.25pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
</div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
</div>
</div>
<br />
<!--yllix ad--><br />
<script src="//ylx-1.com/bnr.php?section=General&pub=816522&format=300x50&ga=g&mbtodb=1" type="text/javascript"></script><br />
<noscript><a href="https://yllix.com/publishers/816522" target="_blank"><img src="//ylx-aff.advertica-cdn.com/pub_0ei6v1.png" border="0" /></a></noscript></div>
<br />
<!--gist_code--><br />
<script src="https://gist.github.com/sapal6/452596b64f56a20884ccf4b0543266b2.js"></script><span id="docs-internal-guid-cc069332-5021-9273-5b2d-ba7c6bc82592"><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">Copy & paste the above code in your editor and run this code. In the above code we have an </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">If </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">condition & an </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">else </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">condition. Let’s assume we have the </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">age </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">as </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">100.</span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;"> Now when the above code runs the code touches the </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">If </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">condition & checks if age is greater than or equal to 0 or age is less than or equal to 99. Notice that we have used an </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">or</span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;"> operator so the condition becomes </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">True</span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;"> even if only one of the condition matches & as age is 100 ( greater than 0) so the If condition returns a True & the control enters the If statement to print the statement inside the print method.</span></span><br />
<span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;"><br />
</span> <span id="docs-internal-guid-cc069332-5022-0708-08db-f79a03ee599a"><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">Let’s modify our If-Else statement to make it more robust. Copy and paste the below code in your editor and give it a spin→</span></span><br />
<br /></div>
<!--gist code--><br />
<script src="https://gist.github.com/sapal6/ec288a76328d044fe14415f4c6e7c387.js"></script><br />
<br />
<br />
<!--yllix ad--><br />
<script src="//ylx-1.com/bnr.php?section=General&pub=816522&format=300x50&ga=g&mbtodb=1" type="text/javascript"></script><br />
<noscript><a href="https://yllix.com/publishers/816522" target="_blank"><img src="//ylx-aff.advertica-cdn.com/pub_0ei6v1.png" border="0" /></a></noscript><span id="docs-internal-guid-cc069332-5026-3425-a49b-6e5a0228cc6d"><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">As you can see this time we have an </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">and </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">operator instead of an </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">or. </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">So this time our If condition will return </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">True </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;"> only when </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">age </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">is greater than or equal to 0 and less than or equal to 99. Now as we have the value of age out of the bounds of 0 to 99 so the control skips the If condition & jumps to the line of code immediately after that which is the </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Elif </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;"> statement. This kind of expression is known as a </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> Nested if-else </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">statement, wherein we have another </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">If </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">condition immediately after the first If condition to put a second conditional check and in python programming language it’s written as </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Elif. </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">In our case the control checks that age is not satisfying even the condition inside the nested If statement so it skips that too and jumps to the next condition i.e the </span><span style="font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Else </span><span style="font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;"> statement and as there are no further condition defined for this else statement, so it returns a True & the statement inside the print method is printed.</span></span><br />
<br />
<!--gist code--><br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Conclusion→</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">You can define </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">n number of rules </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">using the </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">nested</span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if-else </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">conditional statements. Go ahead try to extend on the above example code by implementing your own rules with nested </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">if-else </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">statements. The code examples can be found in the </span><a href="https://goo.gl/0fzlp5" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Python Decision Making.py</span></a><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> file in my Github repo. </span><br />
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br />
</span> <span style="font-family: "comic sans ms";"><span style="font-size: 18.6667px; white-space: pre-wrap;">I have tried my best to explain how to use if else in python, But if you really want to get deeper into it then checkout this book to get started with learning python in a very interactive manner --> </span></span><a href="https://www.amazon.com/gp/product/1593275994/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1593275994&linkCode=as2&tag=sapal603-20&linkId=5be5be332505da18dc41cf5dd5af3654" target="_blank">Automate the Boring Stuff with Python: Practical Programming for Total Beginners</a><img alt="" border="0" height="1" src="//ir-na.amazon-adsystem.com/e/ir?t=sapal603-20&l=am2&o=1&a=1593275994" style="border: none !important; margin: 0px !important;" width="1" /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">So, folks this was all for this week but we shall return with another chapter of this tutorial with some new concepts to learn.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Subscribe to my youtube </span><a href="https://goo.gl/iYQAnn" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">channel</span></a><span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> to watch the coding in this tutorial in action</span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><br />
<span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<br />
<div style="text-align: left;">
<span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "comic sans ms"; font-size: small; font-style: normal; white-space: normal;"><span style="font-size: 18.6667px; white-space: pre-wrap;"><span style="font-size: small;"><span style="white-space: normal;"><a href="https://goo.gl/MSfyn7">Take me to Python Tutorial - Part 4</a> </span></span></span></span></span><a href="https://goo.gl/m15Vtw">Take me to Python Tutorial - Part 6</a></div>
</div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-29491088728584597922017-05-21T02:25:00.001-07:002017-09-02T03:04:05.384-07:00Logical operators in python : Beginner Python Programming Tutorial - How to become a Python Jedi - Part 3-4<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/rZAu0jkusgU" width="560"></iframe><br />
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span> <span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Welcome back friends to another post on TheCodingProject and we are back with the fourth chapter of the Python programming tutorial - How to become a python Jedi. This time we are going to learn about logical operators.</span></div>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">What are Logical Operators ? </span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 18.6667px;">Logical</span> operators are used to compare any two values, be it two numbers , two strings or any other objects. In short these operators help us to make a decision by giving back the results of a comparison. <span style="font-size: 18.6667px;">logical</span> operators always return either a </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">True</span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or a </span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">False.</span></div>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Different Logical operators →</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 468pt;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 72pt;"><td style="border-bottom: solid #ffffff 1pt; border-left: solid #ffffff 1pt; border-right: solid #ffffff 1pt; border-top: solid #ffffff 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">== Equal to</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">!= Not equal to</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">< Less than</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">> greater than</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><= Less than or equal to</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>= Greater than or equal to</span></div>
</td></tr>
</tbody></table>
</div>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Examples of Logical operators →</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Let’s get into some examples to better understand the usage of comparison operators. Copy the below code and paste it in </span><a href="https://www.jetbrains.com/pycharm/download/#section=linux" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">pycharm</span></a><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or any other editor that you have. Additionally you can also download the </span><a href="https://goo.gl/0fzlp5" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">comparison operators.py</span></a><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> code file of this tutorial from github. →</span></div>
<br />
<!-- placeholder for banner ad from yllix --><br />
<script src="//ylx-1.com/bnr.php?section=General&pub=816522&format=300x50&ga=g&mbtodb=1" type="text/javascript"></script><br />
<noscript><a href="https://yllix.com/publishers/816522" target="_blank"><img src="//ylx-aff.advertica-cdn.com/pub_2hpya3.png" border="0" /></a></noscript><br />
<br />
<!-- placeholder for Gist code block --><br />
<script src="https://gist.github.com/sapal6/95ade9793f357664f0c77fdddabbfa4e.js"></script><br />
<br />
<br />
<br />
<span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">For the first print statement the </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Equals to </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">operator denotes that we want to compare that whether the integers </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">1 </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">& </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">2 </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">are equal to each other or not. When the control finds that both the integer values are not equal then it returns a </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">False. </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">Similarly for the second print statement when control finds that the two strings are not equal to each other so it returns a False once again. But in the third print statement we are comparing to see if </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">45 </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">is greater than </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">34 </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">and since it’s true, so a value </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">True </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">is returned. Similarly in the last print statement since </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">56 </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">is equal to </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">56, </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">so the condition </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">less than or equal </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">to evaluates to </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">True.</span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: black; font-family: "comic sans ms"; font-size: 14pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> </span><br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">So, folks this was all for this week but we shall return with another chapter of this tutorial with some new concepts to learn.</span></div>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Subscribe to my youtube </span><a href="https://goo.gl/iYQAnn" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">channel</span></a><span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> to watch the coding in this tutorial in action</span><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="background-color: transparent; color: #333333; font-family: "comic sans ms"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<a href="https://goo.gl/RRRrn8"><br />
</a> <br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: center;">
<span style="background-color: transparent; color: black; font-family: "comic sans ms"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/C7ToqV">Take me to Python Tutorial - Part 3</a></span><br />
<a href="https://goo.gl/xdxpEU"><span style="font-family: "comic sans ms";"><span style="font-size: 18.6667px; white-space: pre-wrap;">Take me to Python Tutorial - Part </span></span>5</a></div>
</div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-91126045536733462212017-05-01T00:15:00.000-07:002017-09-02T02:58:50.845-07:00Boolean in Python : How to become a Python Jedi - A Python programming tutorial - part 3<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 24pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<hr />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/dnbMGXU-Rnw" width="560"></iframe><br />
<h2 style="text-align: left;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Welcome back friends to another episode of TheCodingProject and we are back with the third chapter of the Python programming tutorial - How to become a python Jedi. This time we are going to get a taste of boolean operators.</span></h2>
</div>
<b id="docs-internal-guid-8852c778-bdf2-1efa-6074-0769b6937ca0" style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">What are Boolean Operators ? </span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Computers don’t understand the common human language, they only speak and understand machine level language and this language is made up of only two numbers 0 & 1. These numbers are known as binary numbers & this language is known as binary language. Now if you are a crazy nerd like me and you wanna know more then dive in </span><a href="https://en.wikipedia.org/wiki/Binary_code" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">here</span></a><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. The numbers 0 & 1 also represent decision making as they also represent True (for 0) & False (for 1) and these two operators are known as boolean operators. </span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Enough talk man, I’m here to learn code!!😠</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Okay Okay I just took a trip in my emotion boat. I know you want to learn code so let’s just cut the talk talk & dive to code code. Yayyy!!</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Boolean operators in action</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Copy the below code and paste it in </span><a href="https://www.jetbrains.com/pycharm/download/#section=linux" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">pycharm</span></a><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> and any other editor that you have code →</span> <br />
<script src="//ylx-1.com/bnr.php?section=General&pub=816522&format=300x250&ga=g" type="text/javascript"></script> <noscript><a href="https://yllix.com/publishers/816522" target="_blank"><img src="//ylx-aff.advertica-cdn.com/pub/300x250.png" border="0" /></a></noscript> <script src="https://ylx-4.com/layer.php?section=General&pub=816522&ga=g&show=1&fp" type="text/javascript"></script> <span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br />
</span></div>
<b style="font-weight: normal;"><br />
<script src="https://gist.github.com/sapal6/da69aca448080a033c89efa59dd20dc6.js"></script></b> <br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">What the above code gives us ? We remember from above section about boolean operators that they represent True (for 0) & False (for 1) and in the above example for the first print statement when we try to compare OS1 with OS2 the python interpreter checks that </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">IOS(OS1) </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">is not equal to </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Android(OS2) </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">so the interpreter returns a False. In the second print statement we are checking if ‘IOS’ is not equal to ‘Android’ which resolves to true and that’s why the second print statement returns </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">True.</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We shall now look into some more examples. Copy and paste the below code in your editor and run the code →</span></div>
<br />
<div dir="ltr" style="margin-left: 0pt;">
<br /></div>
<b style="font-weight: normal;"><br />
<script src="https://gist.github.com/sapal6/b906404b326741d831da1b3e7b9152a0.js"></script></b> <br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Let’s say you and me are to arrange a party tonight and we list down what we need for the party but we have a difference of opinion and to come to a conclusion we turn to the geeky method of decision making and that’s through python. We list down our choices in the following variables → my choices are listed in </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">drinks </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">and </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">food</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, your choices are listed in </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">for_party</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. Now, we check that is your choice similar to my choice? The first print statement gives us a </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">False</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> because the values </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mojito </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">is not equal to the either </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">drinks</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">food</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. You have noticed that we have used the boolean operator </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">or </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">in the first statement which tells the interpreter to check if the value of variable </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">drinks</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or value of variable </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">food</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> is equal to the value of variable </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">for_party</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. Run the second print statement as well and analyse why we get a True over there. Here’s a hint for you → Notice the </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">is not </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">statement.</span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">To summarize what we have learned through the above examples just go through the below table, it is a kind of cheat sheet during the usage of boolean operators →</span></div>
<div dir="ltr" style="margin-left: 117.75pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="155"></col><col width="127"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Operators</span></div>
</td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Results</span></div>
</td></tr>
<tr style="height: 18pt;"><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: white; color: navy; font-family: "merriweather"; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">True and True</span></div>
</td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: white; color: navy; font-family: "merriweather"; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">True</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: white; color: navy; font-family: "merriweather"; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">True and False</span></div>
</td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: white; color: navy; font-family: "merriweather"; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">False</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: white; color: navy; font-family: "merriweather"; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">False and True</span></div>
</td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: white; color: navy; font-family: "merriweather"; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">False</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: white; color: navy; font-family: "merriweather"; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">True or True</span></div>
</td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: white; color: navy; font-family: "merriweather"; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">True</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: white; color: navy; font-family: "merriweather"; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">True or False</span></div>
</td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: white; color: navy; font-family: "merriweather"; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">True</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: white; color: navy; font-family: "merriweather"; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">False or True</span></div>
</td><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: white; color: navy; font-family: "merriweather"; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">False</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">So, folks this was all for this week but we shall return with another part of this tutorial with some new concepts to learn.</span><br />
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br />
</span> <span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Get the code files for this tutorial in <a href="https://github.com/sapal6/TheCodingProject.git">Github</a>.</span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Subscribe to my YouTube </span><a href="https://goo.gl/iYQAnn" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">channel</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> to watch new python programming tips and tutorials</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<br />
<a href="https://goo.gl/eFFMa4"><br />
</a> <br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: center;">
<h2>
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/eFFMa4">←Take me to Python Tutorial - Part 2</a></span></h2>
<div>
<h2>
<a href="https://goo.gl/MSfyn7"><span style="color: black; font-family: "indie flower"; font-size: 14pt; font-weight: 400; vertical-align: baseline; white-space: pre-wrap;">Take me to Python Tutorial - Part 4</span>→</a></h2>
</div>
</div>
</div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-56474486453997873362017-04-15T03:14:00.002-07:002017-09-01T23:10:31.552-07:00Flow charts in Python : How to become a Python Jedi - A Python programming Tutorial Part 2<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 24pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<hr />
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We all know that programming is a set of instructions, but many a times we forget to think that this set of instructions should make sense to be called a computer program. You can get your dog to fetch a stick just by yelling “FETCH” but if type an instruction like “calculate” it will do nothing other than just sitting there and gaping at your face with that ugly python command prompt look. </span></div>
<b id="docs-internal-guid-2b252ea9-70ee-ef47-f0a5-9203ee7a7e8a" style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<h2 style="text-align: left;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">To command a machine to do a task we need to pass a set of “</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">precise and clear set of instructions that flows seamlessly from one step to another</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">”. This flow of instruction is known as flow control or instruction flow control in the programming world. One handy tool to do this is a flowchart. </span></h2>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">What the hell is a flowchart?</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Well simply put a flowchart is a graphical representation of instructions/logic sets that helps you to visualize the logic that you have formulated for a task.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Let’s get into an example….</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Let’s say that you want to automate the login to your facebook account and want to code the entire process in python, but before you get cosy with your keyboard you need to think and devise a series of steps as below-</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Type the facebook url</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Search for the user id & password text box</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Enter your credentials</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Press the Enter button</span></div>
</li>
</ul>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">It’s time to visualize the steps via a flowchart like the one below -</span></div>
<b style="font-weight: normal;"><br /><img height="317" src="https://docs.google.com/drawings/d/sI13l1N14BbZXtD7d_fAJ8Q/image?w=252&h=317&rev=254&ac=1" style="border: none; transform: rotate(0rad);" width="252" /></b><br />
<div dir="ltr" style="margin-left: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The above flowchart is a visual representation of the steps that you want your code to follow. The boxes represent the different units/steps of the logic that was devised earlier and the arrows represents the “flow” of the program control between different steps of the logic. In actual practice your program should flow through the steps in the same manner as is represented in the above flowchart.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Endnotes</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Devising steps/algorithm for a computer program is not as straightforward as is represented in the above example but I to get a taste of what a flowchart is and how to design a basic flowchart the above example will suffice. </span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Below are some practice exercises that will help you get going till the next tutorial which will be coming your way soon.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quiz</span></div>
<ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">You want to prepare a large jug of lemonade. Write down the steps by step procedure for the same and devise a flowchart that represents the steps.</span></div>
</li>
</ol>
<b style="font-weight: normal;"><br /></b>
<br />
<ol start="2" style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Devise a flowchart to visualize the steps to login to Gmail.</span></div>
</li>
</ol>
<b style="font-weight: normal;"><br /></b>
<br />
<ol start="3" style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Create a flowchart to represent a up of coffee. Also include the necessary steps to check if the gas stove is on or not and whether water has boiled already etc.</span></div>
</li>
</ol>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">So, folks this was all for this week but we shall return with another part of this tutorial with some new concepts to learn.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<scrspan style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Subscribe to my youtube <a href="https://goo.gl/iYQAnn" target="_blank">channel</a> to watch new python programming tips and tutorials</scrspan><span style="font-family: "indie flower"; font-size: 14pt; white-space: pre-wrap;">.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<span id="docs-internal-guid-cfd7e8ba-9d48-9d7e-0ac8-4d0352380482"><br /></span>
<br />
<div style="text-align: center;">
<span id="docs-internal-guid-cfd7e8ba-9d48-9d7e-0ac8-4d0352380482"><a href="https://goo.gl/WXtYbK" style="font-family: "indie flower"; font-size: 14pt; white-space: pre-wrap;">←Take me to Python programming Tutorial - Part 1</a></span></div>
<a href="http://thecodingproject.blogspot.in/2017/05/how-to-become-python-jedi-python.html"><br /></a>
<a href="http://thecodingproject.blogspot.in/2017/05/how-to-become-python-jedi-python.html"><br />
</a><br />
<div style="text-align: center;">
<span id="docs-internal-guid-2dc9e678-c2e3-3391-ccf6-5c1a2ab5baab"><span style="font-family: "indie flower"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/C7ToqV"><span style="font-family: "indie flower";"><span style="font-size: 18.6667px;">Take me to Python programming Tutorial - Part </span></span>3→</a></span></span></div>
<br />
<span style="font-family: "indie flower"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="font-family: "indie flower"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-40711292927937051132017-04-10T01:59:00.001-07:002017-04-15T03:46:54.938-07:00My new Youtube channel<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" id="docs-internal-guid-5e9d86c8-5716-d4d4-4493-ace2da27f951" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="font-family: "indie flower"; font-size: 90.0538px; font-weight: 700; vertical-align: baseline;">New YouTube channel</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="font-family: "indie flower"; font-size: 90.0538px; font-weight: 700; vertical-align: baseline;"></span></div>
<hr />
<br />
<span id="docs-internal-guid-aa3b566d-577b-058c-abd7-3fe1b842e704"><span style="font-family: "indie flower"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;">I always say that thecodingproject exists because of you, it exists because I want to share with you the knowledge and experience that I have gathered over time and make it available for all of you so that you can pursue your passion and love for coding. It's been my continuous endeavor to present you content that is both interesting and useful so that learning coding is no longer boring. To achieve this I have launched my first YouTube channel . Now all of my python coding tips & tricks are also available on YouTube. Visit the link and subscribe to my <a href="https://goo.gl/g4ZcLF" target="_blank">channel</a>.</span></span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/37BbxlzH8jY/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/37BbxlzH8jY?feature=player_embedded" width="320"></iframe></div>
<br /></div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-10018482420458526592017-04-01T00:45:00.002-07:002017-09-01T22:41:10.956-07:00Expressions in Python : How to become a Python programming Jedi - A Python programming Tutorial Part 1<div dir="ltr" style="text-align: left;" trbidi="on">
<head></head> <br />
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 24pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<hr />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/rI-lyUylXQI" width="560"></iframe><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Long Long ago in a Galaxy far far away there was a planet named Quora. There was a growing agitation among the planet’s inhabitants to learn the way of the Python programming Force and become a master in the way of the Python programming Jedi, but very few knew that the secret art of the Jedi is embedded in a book named as TheCodingProject….</span></div>
<b id="docs-internal-guid-8fe45867-2875-4aa3-d3e0-abcaf40ca3b8" style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<h2 style="text-align: left;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">So, let’s begin the journey of learning the secret art of the Python programming Force and we shall together make the journey towards becoming the Python Jedi….</span></h2>
</div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">What is Python?</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">As per </span><a href="https://en.wikipedia.org/wiki/Python_(programming_language)" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Wikipedia</span></a><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> “Python is a widely used </span><a href="https://en.wikipedia.org/wiki/High-level_programming_language" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">high-level</span></a><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://en.wikipedia.org/wiki/General-purpose_programming_language" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">general-purpose</span></a><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://en.wikipedia.org/wiki/Interpreter_(computing)" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">interpreted</span></a><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://en.wikipedia.org/wiki/Dynamic_programming_language" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">dynamic programming language</span></a><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.” Python is an open source programming language which was conceived in the late 1980s and its implementation began in December 1989 by </span><a href="https://en.wikipedia.org/wiki/Guido_van_Rossum" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Guido van Rossum</span></a><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> (more on it </span><a href="https://en.wikipedia.org/wiki/Python_(programming_language)" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">here</span></a><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">). For us it’s sufficient to know that Python is :</span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">High level language</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - Python is a high-level programming language because it provides strong “:abstraction” in the sense that it automates the tasks like “memory management” , “garbage collection” etc. so that the programmer does not have to handle that explicitly while coding which makes the life of lazy programmer like me a simple affair. More on :high-level programming language </span><a href="https://en.m.wikipedia.org/wiki/High-level_programming_language" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">here</span></a><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
</li>
</ul>
<b style="font-weight: normal;"><br />
</b> <br />
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 700; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Interpreted - </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Python is an Interpreted programming language because it doesn't runs off a compiler rather it has to be processed further by another code so that the coding that we have done is understood by the computer. So, such programming language can be written using “natural language” which again helps people like me to spend less time in writing code.</span></div>
</li>
</ul>
<b style="font-weight: normal;"><br />
</b> <br />
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Dynamically typed language -</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> Python is dynamically typed because in python every variable is bound to an object (</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">more on Objects later</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) and every object has to be assigned to a Type (</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">we will dive into what “Types” are later</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">). </span></div>
</li>
</ul>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">How do I install Python?</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Installation of Python is very straightforward. The Python installer and the installation instruction can be found </span><a href="https://www.python.org/downloads/" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">here</span></a><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. Now that Python is installed on our system and since we are the supergeeks that we are, we don't want to waste time and dive straight onto typing our first Python code. But in order to run the python interpreter from the command line or executing a python file from command line our machine should know the folder where python is installed.</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Windows</span></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We have to visit the following path. Refer to the "python path in windows" image below-</span></div>
</li>
</ul>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img height="24" src="https://lh5.googleusercontent.com/Kz9iRDuXIpYQQWUciL0-5riUDcTWq8FSfC7jRLX2oFwggqwRHAu3TPhxd7KoNVDPJrL-j93wflcdrXdBg8Enl-KJFUeX0nvCRLnR73DOGQCDIoyOKWg-_tg7dfmXfzMd5JMbY_xX" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="612" /></span></div>
<b style="font-weight: normal;"><br />
<img alt="python-path-in-windows" height="392" src="https://lh5.googleusercontent.com/iokAbEjEVUNTnRhf0G63TQ-PyisgpG4NI66d5y5XD7WppgGbNUzlFVSLrY7vhmHyZ_E28pavxN-LSQydLq0zy43ZC_5v1YtTBko1gaGsJlPFgppLfogk1LaBFzQiOwCqmn-n8X1k" style="border: none; transform: rotate(0rad);" title="python path in windows" width="326" /></b><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Under system variables we create a variable “PythonPath” and enter the folder name where python is installed and click on ok button. For me it’s </span><span style="background-color: cornsilk; color: black; font-family: "arial"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">C:\Python34, </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">your directory path may vary.</span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Linux</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In Linux python is installed by default (perks of using Linux 😉. So, congratulation Linux users you don't have to worry setting pythonpath.</span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">WHAT IS IDLE ?</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">IDLE is an “Integrated Development Environment” for Python, which is bundled with every Python distribution. It is completely written in Python and the </span><a href="https://en.wikipedia.org/wiki/Tkinter" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Tkinter </span></a><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">GUI toolkit</span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">How do I do it in windows?</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In windows goto the start menu → All programs → search for the folder where python is installed (for me it's Python 3.4 ) → click on the folder → click on the IDLE (Python 3.4 GUI – 32 bit), this should look like something similar to the "Python folder in windows start menu" image below.</span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;"><img alt="Python-folder-in-windows-start-menu" height="379" src="https://lh6.googleusercontent.com/8uo0CEMoIZ37BrHWKVt8H3lWC_iOOdBE0y5-TWDtSBcnAedcliDI6yMGGEzPHbmIsivIfqzUo78uSPGhy1cpfspJFt3ePx8OF7oNwukU_t6qrF0qZvi0oyWaTRmwGtg3olE6iu1D" style="border: none; transform: rotate(0rad);" title="Python folder in windows start menu" width="328" /></span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Once IDLE is launched you will be greeted by the following screen. Something similar to the "Python IDLE" image below –</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "calibri"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img alt="Python-IDLE-editor-in-windows" height="488" src="https://lh5.googleusercontent.com/Xko4YDGF6mPbw0thCBLFmy5ZrFglAHyOX-3i9-SbmxHYlB_tG22LUyT-rpa5t2DsE0m0MnvS9Sj9rtHPNBbUdRgxGgTlTQLS3uYu5XMkVF2ZUMhOnr9k2I6qzqwlAjo-HHMfAv7l" style="border: none; transform: rotate(0rad);" title="Python IDLE" width="464" /></span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">How do I do it in Unix?</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Did you forget what I said above? Linux users get Python by default 😎 In Unix just open the terminal and type ”python” for python 2.X or python3 for 3.x and you will be greeted by the python prompt and I tell you python prompt in Linux is as good as IDLE for windows. Take a look at the "command prompt" image below.</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img alt="Python-prompt-in-linux" height="361" src="https://lh4.googleusercontent.com/r-Wzs_Q5Fh7V_ScVMSnvq7Eo9VoiJ23fs8OG217dfX3dRSPGb1L3bKTIp7yDKeI7yHzIIMxU2zzU0ukHv2xT3vLRDHwmx_7CYnXFsc5qpRDom5IKVlka0_5k_4TFoc-aJNPJ_ShF" style="border: none; transform: rotate(0rad);" title="command prompt" width="507" /></span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">What should I do with the python Interpreter?</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Now that we are armed with the knowledge to invoke the python interpreter, what the interpreter is used for? Well the first thing that we can do what computers do best, yes number crunching but before we do calculation we should know some programming terms.</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-left: 36pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Expressions</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> -</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In programming an expression is an way of defining things to the computer so that it understands what we are commanding it to do. Some examples of expressions are when we want to do addition of two numbers say “2+2”, this way of adding “2” with “2” is what we call as an expression.</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-left: 36pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Operators</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - We can call operators as the agent which enable us to make an expression. In the above example of an expression “2+2” the “+” symbol is an operator. Some examples of expressions are -</span></div>
<div dir="ltr" style="margin-left: 36pt;">
<table style="border-collapse: collapse; border: none; width: 468pt;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border-bottom: solid #ffffff 1pt; border-left: solid #ffffff 1pt; border-right: solid #ffffff 1pt; border-top: solid #ffffff 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">+ # Addition</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">- # Substraction</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">* # Multiplication</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/ # Division</span></div>
</li>
</ol>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Now enough talk let’s get to action. Fire up the interpreter as mentioned in this </span><a href="https://docs.google.com/document/d/11D_gyzvRLuai1uuniO-4o8AEupkDEUTjgek3sT_VJXI/edit#bookmark=kix.ukptyjep2b9c" style="text-decoration: none;"><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">section</span></a><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> and follow the below examples-</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 468pt;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border-bottom: solid #ffffff 1pt; border-left: solid #ffffff 1pt; border-right: solid #ffffff 1pt; border-top: solid #ffffff 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><ol start="5" style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> 2+2</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">4</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> 2 * (5-6)</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">-2</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> 100 * (20-10)</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1000</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> 238/5</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">47.6</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> 3444 * (456/43)</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">36522.41860465116</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> 2**2 # using ** tells python to calculate the power 4</span></div>
</li>
</ol>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Now look at this ↓</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Suppose there is a party for 4 people and you want to order beer cans for the guests , each beer can I $21 ( </span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I don’t drink beer so cut me some slack on the price</span><span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">) and u want to calculate total price of your purchase and since you are a geek we don't use normal calculators or smartphones like mere mortals instead we command python code to do something like this-</span></div>
<div dir="ltr" style="margin-left: -5.75pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="623"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border-bottom: solid #ffffff 0.5pt; border-left: solid #ffffff 0.5pt; border-right: solid #ffffff 0.5pt; border-top: solid #ffffff 0.5pt; padding: 0pt 5.75pt 0pt 5.75pt; vertical-align: top;"><ol start="16" style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> beer_price = 21</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> guests = 4</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> total_price = beer_price * guests</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> total_price</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">84</span></div>
</li>
</ol>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Okay , What did you do just now?</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Let’s break that into more granular level. When we type “beer_price = 21” we are assigning the value 21 to “beer_price” and here “beer_price “ is known as a variable. </span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">A variable can be thought of as a container which has an item i.e. a number “21”. Let’s have another example to make it easy to understand.</span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="margin-left: -5.75pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="623"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border-bottom: solid #ffffff 0.5pt; border-left: solid #ffffff 0.5pt; border-right: solid #ffffff 0.5pt; border-top: solid #ffffff 0.5pt; padding: 0pt 5.75pt 0pt 5.75pt; vertical-align: top;"><ol start="21" style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> android = "KitKat" # a variable “android” which contains the name “KitKat”</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> android # checking what is contained in the variable android</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'KitKat'</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> android = "Lollipop" # now we give another name to variable</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> android # checking what is contained in the variable android </span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'Lollypop' # the content of the variable Is now changed</span></div>
</li>
</ol>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Initially the variable “android” contained the value “KitKat” but after that we assigned a different value to it and now the variable contains the value as “Lollypop” . In short “android” will contain the most recent value that we assign to it and that’s why it’s known as a variable since the information that it contains can vary again and again.</span></div>
<b style="font-weight: normal;"><br />
</b> <br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Endnotes</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Now that we have learned about expressions so we shall gather up your jedi skills as we have to pass the following test which will test our worthiness to continue our journey further...</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quiz</span></div>
<ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Launch the python interpreter.</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Type and expression in the interpreter which will give the sum of the two numbers “200” & “300”.</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Use an expression to calculate the difference of “549” and “679” and multiply this difference with the sum of “999” & “790”.</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: 'Indie Flower'; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Use an expression to divide “9999” with “0” and assign the result to a variable.</span></div>
</li>
</ol>
<br />
<div style="text-align: center;">
<span style="font-size: large;"><b>....To Be Continued...</b></span></div>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><scrspan style="font-size: 12pt; font-style: italic; vertical-align: baseline;">Subscribe to my youtube <a href="https://goo.gl/g4ZcLF" target="_blank">channel</a> to watch new python programming tips and tutorials</scrspan><span style="font-family: "indie flower"; font-size: 14pt;">.</span></span><br />
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br />
</span> <span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><br />
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br />
</span> <br />
<div style="text-align: right;">
<div style="text-align: center;">
<span id="docs-internal-guid-a9cd8f3c-acc0-8e92-f9f5-d87e1ab0c200"><span style="font-family: "indie flower"; font-size: 14pt; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/qc6Jly">Take me to Python Tutorial - Part 2→</a></span></span></div>
</div>
</div>
</div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-89460969633045393832017-03-18T05:13:00.000-07:002017-04-15T03:47:39.004-07:00Multi-assignment in Python<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 24pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Multi-Assignment in Python</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 24pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<hr />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Hello guyz welcome back to thecodingproject after a loong loong time 😌. This past couple of days I was very busy in my other projects and some personal stuff so could not get much time to post anything here but now I am back and I have another topic in #python to deal with.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Today we are going to explore what is “Multi-Assignment”. It’s better to get straight into an example. Let’s consider three variables k.l & m and a list [1,2,3]. Now when you do the following in the python prompt -</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 468pt;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border-bottom: solid #f3f3f3 0pt; border-left: solid #f3f3f3 0pt; border-right: solid #f3f3f3 0pt; border-top: solid #f3f3f3 0pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">k,l,m = [1,2,3]</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Print(k)</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print(l)</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print(m)</span></div>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Output is :</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">3</span></div>
</td></tr>
</tbody></table>
</div>
<b id="docs-internal-guid-9f246091-e155-35a1-4de1-123e56c02036" style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Here each variable (k,l,m) are assigned to each element in the list in that order. That’s why when you type in k you get 1, l gets you 2 and m gets you 3. Instead when you do the following -</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">k,l,m = 1</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">You will get the following error-</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Traceback (most recent call last):</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> File "<input>", line 1, in <module></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">TypeError: 'int' object is not iterable</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The above error occurs because you now have three variable objects k,l & m but you want to assign only a single integer object 1 to all the three variables. So, python can’t iterate through a single object for all the three variables.</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">But when you do this instead-</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">k,l,m= 2,3,4</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">And then you type the following -</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> k</span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2</span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> l</span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">3</span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">>>> m</span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">4</span><span style="background-color: #d9d9d9; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br class="kix-line-break" /></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The concept here is simple. In you example when you assign k,l & m to the list [1,2,3] then python iterates through the list and assigns the list elements to the variables in that order. In the last example when you assign k,l & m to the objects 2,3 & 4, python again iterates through the sequence of integer objects and assigns them to the variables. So, whenever you do such assignments python iterates through the sequence of objects and assigns the reference of the address of these objects to the variables one by one.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">So, folks this was all for this week but more stuffs are coming your way next week, til then happy coding.</span></div>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><scrspan style="font-size: 12pt; font-style: italic; vertical-align: baseline;">Subscribe to my youtube <a href="https://goo.gl/g4ZcLF" target="_blank">channel</a> to watch new python programming tips and tutorials</scrspan><span style="font-family: "indie flower"; font-size: 14pt;">..</span></span><br />
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-12356071151357282022017-02-04T23:17:00.002-08:002017-04-15T03:47:58.972-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img alt="thousand thanku.jpg" height="231" src="https://lh6.googleusercontent.com/YgEzwXEVahmJUB6CMoO6kUydoKvBD3IuCcAP8XZGQW5ePT8TfkuqywF6pjne4ocT4Wb1WHNh1eL1eIb1sajjMT8n3Dr8VcYVBnxs6-32OusJE_HUSnhIXKPppbRProCNI6kwhWjG" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="624" /></span></div>
<b id="docs-internal-guid-cac98984-0d21-cae2-96c4-608b9b5fcfcb" style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Hey friends welcome back to Thecodingproject. You guys must have noticed that last week I didn’t post anything on my blog and that’s because I was having a vacation time with my friends so I couldn’t get time to get online. Even today I am not here to post any article or any tips/tricks here. </span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I am here to say a </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 24pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1000 THANK YOU😂 </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">to you guys and that’s because you people are awesome. It’s because of your love and attention that my blog has now 1000+ views in such a short period of time. I started this blog during November last year with the aim of sharing my knowledge and experience in software programming with the internet community because it was from this community that I self-taught myself coding, so sharing what I have learned over my blog was my way of giving back something to the community. Here is a snapshot of my blogger stats page</span></div>
<b style="font-weight: normal;"><br /><img alt="Screenshot from 2017-02-05 12:24:55.png" height="121" src="https://lh4.googleusercontent.com/KiawJrpeq9knVFZzhslsyPNonJ2lPxBKvltLwCp91I2COmYLjFNV_hy4qOn2FEc4Kp4DFc9mEArboLgeQ0A6Hye7ECHQso9WuGQPrDaorDEpoJl6xnU4QSU5PjvW3Hr_XQ5DRy55" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="327" /></b><br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">These 1000+ views are not just page views for me, infact these 1000 views are the 1000’s of love that you all have given me and in this way you have let me know that my attempt to share my experience with you have been a success. It also shows that I am actually able to answer the questions that you have been searching for long and in this way I think that I am able to help you learn what you want to learn.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">This is not the be all and end all guys I want to continue to do this going forward, and for this I will continue to need your support and love like you have shown till now. Once again thank you all.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If you wanna get started in learning Python then why not get started with the python basics chapter. Check out this link to access the</span><a href="https://goo.gl/NpsFwP" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 14pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> Python Basic Chapter</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">for free.</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If you want to download a copy of the chapter then purchase the chapter by clicking on the</span><a href="https://goo.gl/0rlcPV" style="text-decoration: none;"><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 14pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">following link</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><scrspan style="font-size: 12pt; font-style: italic; vertical-align: baseline;">Subscribe to my youtube <a href="https://goo.gl/g4ZcLF" target="_blank">channel</a> to watch new python programming tips and tutorials</scrspan><span style="font-family: "indie flower"; font-size: 14pt;">..</span></span><br />
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 12pt; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<br />
<br />
<br />
<br /></div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-88545568394556702422017-01-22T09:17:00.002-08:002017-09-04T23:29:41.948-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 32px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Programmer’s skill set</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 32px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<hr />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: center;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><img alt="coding-keyboard.jpg" height="351" src="https://lh4.googleusercontent.com/1KiguQWJqe0_2Y_rcIxvCbn79HsrO4h_q9ZgOiHqSQ8686wYSB-DVi85g8KtuAEMoPtBQm_Jl4ITc5rHPYAJS3mAWJ9ovJZzaOUicZASSI0LrtZRqxeBI5ZyShPtN9lSEBkoOS_B" style="border: none; transform: rotate(0rad);" width="624" /></span></div>
</div>
<b id="docs-internal-guid-1058603c-c72e-d8a3-ac69-afecfa71a773" style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Hey guys welcome to another article of Thecodingproject. Today I will share an answer to another interesting question for you budding programmers out there.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">When I first started learning to code this same question came to mind time and again and the question was what skills sets I should posses as a programmer ? What tool set should I start collecting in my coding toolbox ? </span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">A programming language is just an ends to meet the automation/programming goal of a software engineer. So, I would like to touch base on the skills required by an automation engineer irrespective of the language skill set since it would be applicable to every type of programming language be it JAVA, R , Python etc. So, let's see what skills we need to have as a automation engineer-</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: #333333; font-family: Georgia; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; margin-left: 31px; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-right: 22pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Logical skills-</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> This is a rather obvious skill that every programmer should have because a even writing the first line of code requires logical thinking so that you can frame your code around the correct logic.</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: #333333; font-family: Georgia; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; margin-left: 31px; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-right: 22pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Designing skills-</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> A programmer also needs to be a designer. A good code also needs to have a good design because a badly designed code takes no time to transform itself into a coding nightmare. Who knows due to a bad design there might be a ticking logic bomb waiting to go off when you are doing a demo in front of potential clients.</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: #333333; font-family: Georgia; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; margin-left: 31px; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-right: 22pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Thinking strategically -</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> When designing a piece of code you have to think strategically no matter how small or big the code but you have to think the most efficient solution to the coding problem.</span></div>
</li>
</ul>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I think the above skill set are the tools that every programmer requires. It doesn’t matter if you are writing a small code for your weekend project or you are designing an enterprise level utility but having these tools in your toolbox will take you a long way down your journey in designing an efficient and beautiful code.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">These are my thoughts they doesn’t need to be perfect or a complete set of the required programming skills. So, feel free to add some more skills that you think an automation engineer should possess.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">SO, folks this was all for this week but more stuffs are coming your way next week, til then happy coding.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If you wanna get started in learning Python then why not get started with the python basics chapter. Check out this link to access the</span><a href="https://goo.gl/NpsFwP" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> Python Basic Chapter</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">for free.</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If you want to download a copy of the chapter then purchase the chapter by clicking on the</span><a href="https://goo.gl/0rlcPV" style="text-decoration: none;"><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">following link</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><scrspan style="font-size: 12pt; font-style: italic; vertical-align: baseline;">Subscribe to my youtube <a href="https://goo.gl/g4ZcLF" target="_blank">channel</a> to watch new python programming tips and tutorials</scrspan><span style="font-family: "indie flower"; font-size: 14pt;">..</span></span><br />
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-27446797725421679512017-01-13T22:02:00.001-08:002017-04-15T03:35:05.869-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 32px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">What next after learning Python ?</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 32px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<hr />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Learning a new programming language is like getting a new powerful Motorcycle. You have that shiny new machine which is a work of art and is powerful like a beast. What you do with it? You ride it for a couple of days at neck break speed tackle on a few twisties seek attention of a few people my twisting the hell out of the throttle and then after a few days you just keep it in your garage where it sits idle for a couple of months or years till the time when you again get in the mood to take your old love for a whirl. Well, I don’t do that with my motorcycle or my programming skills and I would suggest that you don’t do it either. Programming is a lot like acquiring a new motorcycle skill, the more you use it responsibly the more mastery you get in it.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Many time I see people learning a programing language and then just keep it in their mind vault for months or years without using it sometimes it’s out of being clueless as to where to implement the newfound skills and at times it’s due to pure laziness. If it’s out of the latter then I can’t help you but if it’s because you are clueless as to how to use it then I am here to take your hand and show you the way or at least suggest you some.</span></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: #333333; font-family: 'Indie Flower'; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The only mantra is to Learn more and keep exploring more. </span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: #333333; font-family: 'Indie Flower'; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Create a blog and share with others what you have learned so that people can learn from you and you can learn from them. </span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: #333333; font-family: 'Indie Flower'; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Implement your knowledge into some practical project on a personal or professional workspace. I am a software test engineer by profession and I have actually implemented my python knowledge to create a framework which helped us to reduce our testing effort by almost 50%. While doing that I learned more as I faced challenges and as I progressed towards resolving those challenges. You may also create a blog or website and put your knowledge to public so that you can actually contribute to the community from which you have acquired the knowledge. </span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: #333333; font-family: 'Indie Flower'; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I run a blog </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/sc9CRm">Thecodingproject</a></span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> where I regularly post topics/articles related to python and by doing this I actually learn something new every time since I have to research a topic myself before creating an article and posting it in my blog.</span></div>
</li>
</ul>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">That’s about it all the more you use your skills the more you will enhance it and while you are on your journey to sharpen your new Jedi force you also give some back to the community from which you acquired the skill in the first place.</span></div>
<b id="docs-internal-guid-a5f76b2a-9b88-0ce8-d1f1-6d478ac4a136" style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">SO, folks this was all for this week but more stuffs are coming your way next week, til then happy coding. </span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If you wanna get started in learning Python then why not get started with the python basics chapter. Check out this link to access the</span><a href="https://goo.gl/NpsFwP" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> Python Basic Chapter</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">for free.</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If you want to download a copy of the chapter then purchase the chapter by clicking on the</span><a href="https://goo.gl/0rlcPV" style="text-decoration: none;"><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">following link</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><scrspan style="font-size: 12pt; font-style: italic; vertical-align: baseline;">Subscribe to my youtube <a href="https://www.youtube.com/channel/UCVeuQC-zwGe2jT31BrzFz6w" target="_blank">channel</a> to watch new python programming tips and tutorials</scrspan><span style="font-family: "indie flower"; font-size: 14pt;">..</span></span><br />
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<br /></div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-58164737070074592452017-01-08T06:33:00.000-08:002017-01-08T06:33:35.092-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="color: black; font-family: "indie flower"; font-size: 32px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Hey Friends I need your help</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="color: black; font-family: "indie flower"; font-size: 32px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<hr />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Hey friends, here at TheCodingProject I constantly try to post topics and articles which are based on questions/topics requested by you on <a href="https://goo.gl/cDSp5H">Quora</a>, <a href="http://twitter.com/@thecodingprojec">Twitter</a> & <a href="https://goo.gl/Z4sHLp">Facebook</a>. It's my constant endeavor to bring to you the best answers to your questions which will satisfy the curious geek in you But I don't think that that it's sufficient, I want to share more with you and for this </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; white-space: pre-wrap;">I am planning to share with you my experiences and Knowledge that I have gained during the years of my tenure in the software industry so that I can also help you achieve your goals and progress in your professional life. I am planning to share this information with you in the form of a book but I really need your help on the project that you want me to work so that I can give you what you want. So, Please fill in the below short survey which will point me in the direction of your thought.</span><br />
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; white-space: pre-wrap;"><br /></span>
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; white-space: pre-wrap;"><br /></span>
<br />
<div style="text-align: center;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; white-space: pre-wrap;"><br /></span></div>
</div>
<center>
<iframe frameborder="0" height="500" marginheight="0" marginwidth="0" src="https://docs.google.com/forms/d/e/1FAIpQLSdB2MSTRtmVCpNYmcgqEwjBKtI0l1FwJ3I4IJq3co_euuTBFQ/viewform?embedded=true" width="760">Loading...</iframe></center>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-66267605631515364622017-01-06T23:43:00.003-08:002017-04-15T03:35:29.937-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 32px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">What is the scope in python?</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 32px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<hr />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Hey everyone TheCodingProject is back with the answer to another question from the world of Python and this time it’s about the “scope” in python code. </span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In Python the scope is indeed decided by the number of indents. It must be 4 spaces. In Python every object always has a local scope and the scope is always decided by the indent of that particular block within which the object is defined. Let's consider an example</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #ffffff 1px; border-left: solid #ffffff 1px; border-right: solid #ffffff 1px; border-top: solid #ffffff 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">def</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> foo </span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">():</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">var</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #4070a0; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'abc'</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">var</span></div>
</li>
</ol>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 12pt; margin-top: 12pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In the above example, the scope of the variable var is limited to the function foo and how is the scope of the variable var is defined? It's defined by the indent that it maintains I.e. by making the indentation such that it comes under the function definition of foo, which tells the Python interpreter that the variable var is within the local scope of function foo. Now if you do the following - </span></div>
<div dir="ltr" style="margin-left: 0.75pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="623"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #ffffff 1px; border-left: solid #ffffff 1px; border-right: solid #ffffff 1px; border-top: solid #ffffff 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">def</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> foo</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">():</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">var</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #4070a0; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'abc'</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">var</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">var</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #4070a0; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'xyz'</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">var</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 12pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">foo</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">())</span></div>
</li>
</ol>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The output should be like the following-</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #ffffff 1px; border-left: solid #ffffff 1px; border-right: solid #ffffff 1px; border-top: solid #ffffff 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">xyz</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">abc</span></div>
</li>
</ol>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Why do you think the value of var was as such? The reason was again teh local scope of variable var. Notice that when the variable var was having a value ‘xyz' then the indent of the variable was same as the function definition of foo so the scope of variable didn't fall under the function definition. So, when we say print(var) then the current value of var was printed I.e. ‘xyz'. In the second print statement when the function foo was called then the value of variable var that was defined inside foo was printed since the instance of var having value ‘abc' was defined inside the indentation of function foo.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Now when we give only 1 space before the variable var inside foo-</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 83px;"><td style="border-bottom: solid #ffffff 1px; border-left: solid #ffffff 1px; border-right: solid #ffffff 1px; border-top: solid #ffffff 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">def</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> foo</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">():</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">var</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #efefef; color: #4070a0; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">'abc'</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #efefef; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">var</span></div>
</li>
</ol>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">When you try to call the above function the interpreter will throw an error since we have defined only a single space before the variable var.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">So, you see in Python the scope is decided by the indentation and the indent is 4 spaces and this is how the interpreter understands that which scope is to be used and under which block of code.</span></div>
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; white-space: pre-wrap;">So, folks this was all for this week but more stuffs are coming your way next week, til then happy coding. </span><br />
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If you wanna get started in learning Python then why not get started with the python basics chapter. Check out this link to access the</span><a href="https://goo.gl/NpsFwP" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> Python Basic Chapter</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">for free.</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If you want to download a copy of the chapter then purchase the chapter by clicking on the</span><a href="https://goo.gl/0rlcPV" style="text-decoration: none;"><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">following link</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><scrspan style="font-size: 12pt; font-style: italic; vertical-align: baseline;">Subscribe to my youtube <a href="https://www.youtube.com/channel/UCVeuQC-zwGe2jT31BrzFz6w" target="_blank">channel</a> to watch new python programming tips and tutorials</scrspan><span style="font-family: "indie flower"; font-size: 14pt;">..</span></span><br />
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f you have any questions, suggestions or comments you can post your comment here or you can also bug me on </span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> or on </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: italic; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<br /></div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-11059970969303345072016-12-30T23:22:00.003-08:002016-12-31T23:18:12.824-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 32px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Testing Python Code</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 32px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<hr />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Testing your code is very important to know if your code is having the expected behavior. No one likes a software program which would give a weird result or a program which would break in the middle of a critical task and throw of ugly error codes. For this and many more reasons it’s very important to test you code before making it public, testing is not a “best practice” rather it’s a necessity to deliver clean and delicious code which will obey all the commands that the user provides. </span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">There are many different python modules like unittest that help you to test units of your code and then there are some tools like py.test that helps you achieve the same goal, but I want to point out a simple & fast way to quickly test your piece of code without importing any separate module other than the one that is included in your project or which you have created for testing your code.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Testing code in isolation</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In every type of code you must first design your code in modularised way to make debugging and maintenance easier . Let me show you one example -</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Consider the following code -</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #ffffff 1px; border-left: solid #ffffff 1px; border-right: solid #ffffff 1px; border-top: solid #ffffff 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">def</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_example1 </span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">a</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">b</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">):</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> a</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">+</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">b</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">def</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_example2 </span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">a</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">b</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">):</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> a</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">*</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">b</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">def</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_main</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">func_example1</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">a</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">b</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">),</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_example2</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">a</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">b</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)):</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> result </span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_example1 </span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">+</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_example2</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> result</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">func_main</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">func_example1</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #f4f4f4; color: #40a070; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: #f4f4f4; color: #40a070; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">),</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_example2</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #f4f4f4; color: #40a070; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">3</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: #f4f4f4; color: #40a070; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">4</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">))</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
</li>
</ol>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 12pt; margin-top: 12pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> The above pseudo code is </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">modularised</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> meaning that a specific feature is divided into different functions like func_example1, func_example2 & func_main. Now since the code is divided into different functions so we can test each function separately and to do this it’s better if a separate “test module” is created where we can invoke a particular function under test with mock objects </span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">to check that the function is really performing the intended action. Let’s consider the above pseudo code example, I will place the above code in a module named as “main_module” (you can name it as you like). I will create another module and name it as “test_module” & import the “main_module” into that -</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #ffffff 1px; border-left: solid #ffffff 1px; border-right: solid #ffffff 1px; border-top: solid #ffffff 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">import</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> main_module</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #60a0b0; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># todo - call function to be tested</span></div>
</li>
</ol>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We have our module ready now so we can test each function individually and for this we will pass mock objects to the function under test by invoking the function from the main_module into the test module & recording its output.</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom: solid #ffffff 1px; border-left: solid #ffffff 1px; border-right: solid #ffffff 1px; border-top: solid #ffffff 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">import</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> main_module</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">output </span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> main_module</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">func_example1 </span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #f4f4f4; color: #40a070; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: #f4f4f4; color: #40a070; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #f4f4f4; color: #4070a0; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"the output of func_example1 is"</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">+</span><span style="background-color: #f4f4f4; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> output</span><span style="background-color: #f4f4f4; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)</span></div>
</li>
</ol>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I invoked only the func_example1 from the main_module and passed the objects ‘1’ & ‘2’ (which may be different from the actual data) & I could now record & test the behavior of this function in isolation which will help me to zero in on any possible bug or identify any improvement needed in that particular block of code.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Brute force method to Test the program end to end</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 235px;"><td style="border-bottom: solid #ffffff 1px; border-left: solid #ffffff 1px; border-right: solid #ffffff 1px; border-top: solid #ffffff 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">def</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_example1 </span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">a</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">b</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">):</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #efefef; color: #902000; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Print</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #efefef; color: #4070a0; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"1st function is now invoked"</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #efefef; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> a</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">+</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">b</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">def</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_example2 </span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">a</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">b</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">):</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #efefef; color: #902000; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Print</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #efefef; color: #4070a0; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"2nd function is now invoked"</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #efefef; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> a</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">*</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">b</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">def</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_main</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">func_example1</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">a</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">b</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">),</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_example2</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">a</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">b</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)):</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #efefef; color: #902000; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Print</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #efefef; color: #4070a0; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">"main function is now invoked"</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">)</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> result </span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_example1 </span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">+</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_example2</span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #efefef; color: #007020; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> result </span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
</li>
<li dir="ltr" style="background-color: #efefef; color: #999999; font-family: Verdana; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">func_main</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">func_example1</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #efefef; color: #40a070; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: #efefef; color: #40a070; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">),</span><span style="background-color: #efefef; color: #666666; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> func_example2</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="background-color: #efefef; color: #40a070; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">3</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="background-color: #efefef; color: #40a070; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">4</span><span style="background-color: #efefef; color: #666600; font-family: "verdana"; font-size: 13.333333333333332px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">))</span></div>
</li>
</ol>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In the above pseudo code I have inserted simple print statements inside every function so that each time that function is invoked anywhere the statement inside the print () will be displayed on the screen along with the regular return value or action of that function which can help us test if the desired function/code block is invoked and if the control is traversing the code in the expected manner.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Using print statements like above may be a brute force way or may be a novice way to test the control flow but it’s simple & is very useful way to quickly devise a system so that you can track your program flow. I am not saying that this is the only way or it is the best way to do things but it’s one of the practical way to test your code in a short period of time and it’s more visual. If you hate the “print” statements then you can create another function which will write the output message into a log file which can be later analysed to check if your program flow is as expected or you can refer the log in case you have a break in your code. </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; white-space: pre-wrap;">So, folks this was all for this week but more stuffs are coming your way next week, till then happy coding.</span></div>
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you found this post helpful and you have any suggestion to improve my blog then do post your comments below. </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Additionally you can also bug me on</span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="font-family: "indie flower"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;">You can also find me on</span><span style="font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="color: #333333; font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;"> or </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="color: #333333; font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;">. So, why wait go ahead and start exploring. </span><br />
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<br />
<div style="font-family: "times new roman";">
<div style="margin: 0px;">
</div>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you wanna get started in learning Python then why not get started with the python basics chapter. </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Check out this link to access the</span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/BlBVk2" style="text-decoration: none;"> </a></span><span id="docs-internal-guid-a9da7e12-58e4-2f14-1bff-cc06c84aa6d9"><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/NpsFwP" style="text-decoration: none;">Python Basic Chapter</a> </span></span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">for free.</span></div>
<span id="docs-internal-guid-a9da7e12-58ca-4403-8c34-a334012e5942" style="font-weight: normal;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you want to download a copy of the chapter then purchase the chapter by clicking on the </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/0rlcPV">following link</a></span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">. </span></div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-14594798656710532352016-12-23T23:57:00.001-08:002016-12-31T22:59:09.321-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="font-family: "indie flower";"><span style="font-size: 32px; white-space: pre-wrap;"><b>Python Tutorials</b></span></span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="color: black; font-family: "indie flower"; font-size: 32px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<hr />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If you want to download a copy of the chapter then purchase the chapter by clicking on the </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">button below</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. This lesson is based on google docs so if you have any doubts on any of the topics in this lesson then you can just put a comment against that topic and I will answer that question there itself so that you don’t need to navigate to any other page or document to view the answer. </span></div>
<b id="docs-internal-guid-a9da7e12-58c7-47ef-c40d-711a9247bb8f" style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-a9da7e12-58d2-7ab1-33f3-a6ff451664bc"><span style="color: #333333; font-family: "Indie Flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Additionally you can also bug me on</span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="color: #333333; font-family: "Indie Flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #1155cc; font-family: "Indie Flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="font-family: "Indie Flower"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">. You can also find me on </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="color: #1155cc; font-family: "Indie Flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="color: #333333; font-family: "Indie Flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> or </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="color: #1155cc; font-family: "Indie Flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="color: #333333; font-family: "Indie Flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">. So, why wait go ahead and start exploring. </span></span></div>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Click on the button below to purchase the chapter</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div style="text-align: center;">
<center>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="paypal">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="2CEZMMDDQYR5C" />
<input alt="PayPal – The safer, easier way to pay online!" border="0" name="submit" src="https://www.paypalobjects.com/en_GB/i/btn/btn_cart_LG.gif" type="image" />
<img alt="" border="0" height="1" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" />
</form>
</center>
</div>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<div style="font-family: "times new roman"; margin: 0px;">
</div>
</div>
<br />
<div style="margin: 0px;">
<br /></div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-80125509323173579462016-12-17T06:20:00.001-08:002017-04-15T03:36:08.550-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 32px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">How to learn Python in short time?</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 32px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<hr />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Many times people ask me this question </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">How to learn Python in as short time as possible ?</span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> . I myself had this question when I was first starting out and at that time I searched and searched over internet to find a magical shortcut to learn Python, but I found none. The reality is that the “short span” of time that we want is actually relative as for some it may take a month and for some it may to 3 months or even more and that depends on individual learning capacity which is OK. It took me 2 months or so to learn the language 😄. But that’s me someone else may take more or lesser time than me. The key here is to learn by doing. You can check through the following to start learning -</span></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: #333333; font-family: 'Indie Flower'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">First start with the basics Visit the </span><a href="https://goo.gl/jtCWZ7" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">post</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> in this blog to know about where to start so that you can get to know at least the basic concepts that can get you started with this programming language.</span></div>
</li>
</ul>
<b id="docs-internal-guid-e71ef17c-0d26-4f57-f52c-5dfe57f4b733" style="font-weight: normal;"><br /></b>
<br />
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: #333333; font-family: 'Indie Flower'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Once you get going with the basic concepts you can pick a small project and started working on it. To get an idea of what your project should look like you can visit this </span><a href="https://goo.gl/LvoaMv" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">post</span></a><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> on our blog initially your progress will be slow but this is what will drive you to research the topic on which you want to build your project and as you research more and progress on building your project you will gain more insight and deeper understanding of the programming language which will further help you in </span><span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">learning by doing .</span></div>
</li>
</ul>
<b style="font-weight: normal;"><br /></b>
<br />
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: #333333; font-family: 'Indie Flower'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Once you get started with your project then make it a point to complete it because if you leave that in between thinking that it is difficult to learn that way or you may find an easier project to work on then you won’t face any challenges while you work on that project which in turn will limit your capability to solve a difficult problem and this will keep you away from gaining the experience of creating an indigenous solution to a difficult problem. It is your ability to find a solution to a coding challenge that will give teach you deeper concept of coding.</span></div>
</li>
</ul>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Follow the above steps to progress in learning Python by actually coding which will give you more knowledge than just reading books or going through online courses. Remember the more you practice the more you will learn.</span><br />
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<div style="margin: 0px;">
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"><scrspan style="color: #333333; font-size: 12pt; font-style: italic; vertical-align: baseline;">Subscribe to my youtube <a href="https://www.youtube.com/channel/UCVeuQC-zwGe2jT31BrzFz6w" target="_blank">channel</a> to watch new python programming tips and tutorials</scrspan><span style="font-family: "indie flower"; font-size: 14pt;">.</span></span><br />
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you found this post helpful and you have any suggestion to improve my blog then do post your comments below. </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Additionally you can also bug me on</span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="font-family: "indie flower"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;">You can also find me on</span><span style="font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="color: #333333; font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;"> or </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="color: #333333; font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;">. So, why wait go ahead and start exploring. </span><br />
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<br />
<div style="font-family: "times new roman";">
<div style="margin: 0px;">
</div>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you wanna get started in learning Python then why not get started with the python basics chapter. </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Check out this link to access the</span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/BlBVk2" style="text-decoration: none;"> </a></span><span id="docs-internal-guid-a9da7e12-58e4-2f14-1bff-cc06c84aa6d9"><a href="https://goo.gl/NpsFwP" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Python Basic Chapter</span></a></span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> for free.</span></div>
<span id="docs-internal-guid-a9da7e12-58ca-4403-8c34-a334012e5942" style="font-weight: normal;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you want to download a copy of the chapter then purchase the chapter by clicking on the </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/0rlcPV">following link</a></span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">. </span></div>
</div>
</div>
<div>
<div style="margin: 0px;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
</div>
<div style="font-family: "times new roman"; margin: 0px;">
</div>
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"><span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f" style="color: black; font-family: "times new roman"; font-size: small; white-space: normal;"></span></span><br />
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<center>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="paypal">
<br /></form>
</center>
</div>
<div>
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-91961717231317648082016-12-10T00:15:00.000-08:002016-12-31T23:18:48.055-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 32px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">How Python implements “Data Encapsulation”?</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "indie flower"; font-size: 32px; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<hr />
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Data privacy or “data encapsulation” is provided by Python by default. In Python every variable or method is scoped within its parent code block. Look at the below function-</span></div>
<ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: 'Indie Flower'; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 12pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">def newcurrencynote():</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: 'Indie Flower'; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> newnote = 2000</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: 'Indie Flower'; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> print("This is new" + newnote + "currency note")</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: 'Indie Flower'; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: 'Indie Flower'; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print(newnote)</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: 'Indie Flower'; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 12pt; margin-top: 0pt;">
<span style="background-color: #f4f4f4; color: #666666; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">print(example())</span></div>
</li>
</ol>
<span id="docs-internal-guid-91da0ab5-e799-7b88-da4e-14eb8819ddc6"></span><br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In the above function newcurrencynote() the variable newnote inside the function has “ local” scope within that function, in other words it is private to that functions only and is not accessible outside that function . So, the first print function gives an error stating that you should initialize the variable first and then print it, but since the second function is trying to access the function itself so it will print the value of the variable.</span><br />
<span style="background-color: transparent; color: #333333; font-family: "indie flower"; font-size: 18.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<div style="margin: 0px;">
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you found this post helpful and you have any suggestion to improve my blog then do post your comments below. </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Additionally you can also bug me on</span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="font-family: "indie flower"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;">You can also find me on</span><span style="font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="color: #333333; font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;"> or </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="color: #333333; font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;">. So, why wait go ahead and start exploring. </span><br />
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<br />
<div style="-webkit-text-stroke-width: 0px; color: black; font-family: "Times New Roman"; font-size: medium; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<div style="margin: 0px;">
</div>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you wanna get started in learning Python then why not get started with the python basics chapter. </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Check out this link to access the</span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/BlBVk2" style="text-decoration: none;"> </a></span><span id="docs-internal-guid-a9da7e12-58e4-2f14-1bff-cc06c84aa6d9"><a href="https://goo.gl/NpsFwP" style="text-decoration: none;"><span style="color: #1155cc; font-family: "Indie Flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Python Basic Chapter</span></a></span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> for free.</span></div>
<span id="docs-internal-guid-a9da7e12-58ca-4403-8c34-a334012e5942" style="font-weight: normal;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you want to download a copy of the chapter then purchase the chapter by clicking on the </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/0rlcPV">following link</a></span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">. </span></div>
</div>
</div>
<center>
</center>
</div>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-27920427086692409912016-12-06T20:34:00.004-08:002016-12-31T23:19:07.125-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f"></span><br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f"><span style="font-family: "indie flower"; font-size: 32px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">What is Duck Typing</span></span></div>
<span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f">
</span>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f"><span style="font-family: "indie flower"; font-size: 32px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"></span></span></div>
<span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f">
</span>
<br />
<hr />
<span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f">
<br />
</span><br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f"><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">I had originally answered this on </span><a href="https://www.quora.com/What-is-Duck-typing-in-Python/answer/Satyabrata-Pal-1?srid=H5aj" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> and thought that I should also make it available here in my blog for the readers who do not follow Quora (by the way it's a great site and you should follow that 😎). </span></span></div>
<span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f">
</span>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f"><a href="https://www.quora.com/What-is-Duck-typing-in-Python/answer/Satyabrata-Pal-1?srid=H5aj" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Duck typing</span></a><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> is a concept that says that the “type” of the object is a matter of concern only at runtime and you don’t need to to explicitly mention the type of the object before you perform any kind of operation on that object.</span></span></div>
<span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f">
</span>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f"><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">The following example can help in understanding this concept -</span></span></div>
<span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f">
</span>
<ol style="margin-bottom: 0pt; margin-top: 0pt;"><span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f">
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: "Indie Flower"; font-size: 18.6667px; list-style-type: decimal; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 12pt;">
<span style="color: #007020; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">def</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> calc</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">a</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">b</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">):</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: "Indie Flower"; font-size: 18.6667px; list-style-type: decimal; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 12pt; margin-top: 0pt;">
<span style="color: #007020; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">return</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> a</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">+</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">b</span></div>
</li>
</span></ol>
<span id="docs-internal-guid-0faa9f37-d78f-254a-ca3f-725a25efc18f">
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Now, Python says that for the above function I don’t need to be concerned about the “type” of the objects ‘a’ & ‘b’ and that the type will be taken care of during runtime as long as the objects support the ‘+’ . So, keeping this in mind the above function will work for any “type” of object which supports the </span><a href="https://goo.gl/jtCWZ7" style="text-decoration: none;"><span style="color: #2b6dad; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">operator </span></a><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">+ i.e. it will return valid values for a string, list or Integer. When I pass the following “types” of object then the function should work-</span></div>
<ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: "Indie Flower"; font-size: 18.6667px; list-style-type: decimal; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 12pt;">
<span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">calc</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="color: #40a070; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">1</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="color: #40a070; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">2</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">)</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">→</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> will </span><span style="color: #007020; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">return</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #40a070; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">1</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">+</span><span style="color: #40a070; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">2</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">=</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #40a070; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">3</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: "Indie Flower"; font-size: 18.6667px; list-style-type: decimal; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">calc</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">(</span><span style="color: #4070a0; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">'hello'</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="color: #4070a0; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">'world'</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">)</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">--></span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> will </span><span style="color: #007020; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">return</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> hello world</span></div>
</li>
<li dir="ltr" style="background-color: #f4f4f4; color: #999999; font-family: "Indie Flower"; font-size: 18.6667px; list-style-type: decimal; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 12pt; margin-top: 0pt;">
<span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">calc</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">([</span><span style="color: #40a070; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">1</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">],[</span><span style="color: #40a070; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">2</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">])</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">--></span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> will </span><span style="color: #007020; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">return</span><span style="color: #666666; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">[</span><span style="color: #40a070; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">1</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">,</span><span style="color: #40a070; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">2</span><span style="color: #666600; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">]</span></div>
</li>
</ol>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">What we got in the above results?</span></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="color: #333333; font-family: "Indie Flower"; font-size: 18.6667px; list-style-type: disc; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-right: 22pt; margin-top: 0pt;">
<span style="font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">In the first example of 1,2 since python interpreter recognizes these objects as type integer and since the </span><a href="https://goo.gl/jtCWZ7" style="text-decoration: none;"><span style="color: #2b6dad; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">operator </span></a><span style="font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">+ is valid for integers so the function calc returns a valid output of “type”integer 3. Here while passing the objects 1,2 to the function calc we are not defining that these objects are “type” integer as due to duck typing concept in python, the objects 1,2 are interpreted as integers and hence the function calc must return an output of type integer.</span></div>
</li>
<li dir="ltr" style="color: #333333; font-family: "Indie Flower"; font-size: 18.6667px; list-style-type: disc; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-right: 22pt; margin-top: 0pt;">
<span style="font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">In the second example we did not explicitly mentioned anywhere that the objects hello & world are of “type” string, but duck typing concept comes into play and the interpreter recognizes these objects as strings during runtime and when these are passed to the function calc then the output should be a valid string ‘hello world’.</span></div>
</li>
<li dir="ltr" style="color: #333333; font-family: "Indie Flower"; font-size: 18.6667px; list-style-type: disc; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 11pt; margin-right: 22pt; margin-top: 0pt;">
<span style="font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">In the third example also duck typing can be noticed as the “type” of [1] & [2] is interpreted by python as lists and so the operator + should concatenate (which is a valid operation for lists) these two strings into a bigger string.</span></div>
</li>
</ul>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">More about operators </span><a href="https://goo.gl/jtCWZ7" style="text-decoration: none;"><span style="color: #2b6dad; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">here</span></a></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Now that you know what duck typing is and that it’s one of the powers of Python you can get started in learning the other features of Python and start exploring this programming language. </span><span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you found this post helpful and you have any suggestion to improve my blog then do post your comments below. </span><br />
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you wanna get started in learning Python then why not get started with the python basics chapter. </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Check out this link to access the</span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/BlBVk2" style="text-decoration: none;"> </a></span><span id="docs-internal-guid-a9da7e12-58e4-2f14-1bff-cc06c84aa6d9"><a href="https://goo.gl/NpsFwP" style="text-decoration: none;"><span style="color: #1155cc; font-family: "Indie Flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Python Basic Chapter</span></a></span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> for free.</span></div>
<span id="docs-internal-guid-a9da7e12-58ca-4403-8c34-a334012e5942" style="font-weight: normal;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you want to download a copy of the chapter then purchase the chapter by clicking on the </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/0rlcPV">following link</a></span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">. </span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<span id="docs-internal-guid-a9da7e12-58d2-7ab1-33f3-a6ff451664bc"><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Additionally you can also bug me on</span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="font-family: "indie flower"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">. </span><span style="font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;">You can also find me on</span><span style="font-family: "indie flower"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> or </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">. So, why wait go ahead and start exploring. </span></span></div>
</span><br />
<center>
</center>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0tag:blogger.com,1999:blog-7431444751625527097.post-62145860350795515802016-12-03T01:52:00.001-08:002017-04-15T03:36:32.705-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<h1 dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 20pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 32px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Weekend Project - Weekend Emotion</span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 26.666666666666664px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><hr />
</span></h1>
<h2 style="text-align: left;">
<span id="docs-internal-guid-ec608246-c412-ddec-6dc4-876b84172918" style="font-weight: normal;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Welcome to another awesome weekend and starting today every weekend we are going to do some fun projects and today we are going to do something related to weekend. First of all create an empty python file with the name </span><span style="font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">weekend_emotons.py</span><span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> , it is very important to keep the extension of the file as </span><span style="font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">py</span><span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> which will tell the interpreter that this is a python scrpt file. Save the file in the path of you choice (for my machine the path is </span><span style="font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">~/PycharmProjects/untitled</span><span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">). Paste/type the following code into this file -</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="259"></col></colgroup><tbody>
<tr style="height: 241px;"><td style="border-bottom: solid #ffffff 1px; border-left: solid #ffffff 1px; border-right: solid #ffffff 1px; border-top: solid #ffffff 1px; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap;">def weekn(day):</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap;"> say_like = ""</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap;"> if day == "Saturday":</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap;"> say_like = "HURRAY it's weeknd :D:D"</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap;"> print(say_like)</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap;"> elif day == "Weekday":</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap;"> say_like = ":( :("</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap;"> print(say_like)</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap;"> elif day == "Friday":</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap;"> say_like = "Yeeeee :D :D"</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap;"> print(say_like)</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap;">today = "Saturday"</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 13.3333px; vertical-align: baseline; white-space: pre-wrap;">weekn(today)</span></div>
</td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Save the file and then open the command prompt and type </span><span style="font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">python3 weekend_emotons.py</span><span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> and if you are in linux or </span><span style="font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">weekend_emotons.py</span><span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> if you are in windows and voila you will get the desired message depending on the day you have passed in the variable </span><span style="font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">today</span><span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">What the code does?</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">We created a function </span><span style="font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">weekn </span><span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">which takes in a parameter </span><span style="font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">day</span><span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">. The code checks what day it is, if it’s saturday then it prints the appropriate message and if it’s some other day then it prints the required message. In the variable </span><span style="font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">today</span><span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> we pass the day we want and the function returns the required message to us.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">What else now?</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Now that you have run the above code and successfully generated the message why not make the code more dynamic? Why not improve it to make it more shorter? So go ahead play around the code an you can post your version in the comment section below.</span><br />
<br />
<div dir="ltr" style="font-size: medium; line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"><scrspan style="color: #333333; font-size: 12pt; font-style: italic; vertical-align: baseline;">Subscribe to my youtube <a href="https://www.youtube.com/channel/UCVeuQC-zwGe2jT31BrzFz6w" target="_blank">channel</a> to watch new python programming tips and tutorials</scrspan><span style="font-family: "indie flower"; font-size: 14pt;">..</span></span><br />
<span style="color: black; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="color: black; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you wanna get started in learning Python then why not get started with the python basics chapter. </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Check out this link to access the</span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/BlBVk2" style="text-decoration: none;"> </a></span><span id="docs-internal-guid-a9da7e12-58e4-2f14-1bff-cc06c84aa6d9"><a href="https://goo.gl/NpsFwP" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Python Basic Chapter</span></a></span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> for free.</span></div>
<div style="font-size: medium;">
<span id="docs-internal-guid-a9da7e12-58ca-4403-8c34-a334012e5942" style="font-weight: normal;"><br /></span></div>
<div dir="ltr" style="font-size: medium; line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">If you want to download a copy of the chapter then purchase the chapter by clicking on the </span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><a href="https://goo.gl/0rlcPV">following link</a></span><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">. </span></div>
<div dir="ltr" style="font-size: medium; line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div style="font-size: medium;">
<span id="docs-internal-guid-a9da7e12-58d2-7ab1-33f3-a6ff451664bc"><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">Additionally you can also bug me on</span><a href="https://www.quora.com/profile/Satyabrata-Pal-1" style="text-decoration: none;"><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Quora</span></a><span style="font-family: "indie flower"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">. </span><span style="font-family: "indie flower"; vertical-align: baseline; white-space: pre-wrap;">You can also find me on</span><span style="font-family: "indie flower"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="https://twitter.com/thecodingprojec" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Twitter</span></a><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;"> or </span><a href="https://goo.gl/Z4sHLp" style="text-decoration: none;"><span style="color: #1155cc; font-family: "indie flower"; font-size: 18.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Facebook</span></a><span style="color: #333333; font-family: "indie flower"; font-size: 18.6667px; vertical-align: baseline; white-space: pre-wrap;">. So, why wait go ahead and start exploring. </span></span></div>
</div>
</span></h2>
<center>
</center>
</div>
Satyahttp://www.blogger.com/profile/10718029578993129708noreply@blogger.com0