Skip to content

Instantly share code, notes, and snippets.

@kgashok
Created April 6, 2018 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgashok/44e023fc8319f095e4149b208e0dee72 to your computer and use it in GitHub Desktop.
Save kgashok/44e023fc8319f095e4149b208e0dee72 to your computer and use it in GitHub Desktop.
importantTopics-kgashok
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>importantTopics-kgashok</title>
<link rel="stylesheet" href="https://stackedit.io/style.css" />
</head>
<body class="stackedit">
<div class="stackedit__left">
<div class="stackedit__toc">
<ul>
<li><a href="#useful-links-to-explore">Useful links to explore</a></li>
<li><a href="#important-concepts">Important Concepts</a>
<ul>
<li><a href="#iterables">0.0 Iterables</a></li>
<li><a href="#types-and-their-attributes-aka-methods-unit-3">0.1 Types and their attributes (aka methods, Unit 3)</a></li>
<li><a href="#differentiate-between-parameters-and-arguments-unit-3">1. Differentiate between parameters and arguments (Unit 3)</a></li>
<li><a href="#explain-immutability-with-reference-to-the-various-data-types-in-python.-unit-3">2. Explain Immutability with reference to the various data types in Python. (Unit 3)</a></li>
<li><a href="#what-is-list-comprehension-and-what-is-the-main-benefit-describe-with-an-example.-unit-4">3. What is list comprehension and what is the main benefit? Describe with an example. (Unit 4)</a></li>
<li><a href="#slicing-as-an-object">4. Slicing as an Object</a></li>
<li><a href="#if-python-is-interpreted-what-are-.pyc-files">5. If Python is interpreted, what are .pyc files?</a></li>
<li><a href="#a-string-is-a-recursive-data-structure.-true-or-false">6. A String is a recursive data structure. True or False?</a></li>
<li><a href="#the-xor-trick-grokked-finally">7. The XOR trick, grokked, finally!</a></li>
<li><a href="#packages-and-modules">8. Packages and Modules</a></li>
<li><a href="#how-to-maintain-a-sorted-list">9. How to maintain a sorted list?</a></li>
</ul>
</li>
<li><a href="#misc">Misc</a>
<ul>
<li><a href="#important-links">Important Links</a></li>
<li><a href="#the-best-3-books">The best 3 books</a></li>
<li><a href="#learn-by-example">Learn by Example</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="stackedit__right">
<div class="stackedit__html">
<h1 id="useful-links-to-explore">Useful links to explore</h1>
<ul>
<li>
<p>See some beautiful Python poems - <a href="https://www.reddit.com/r/programming/comments/26dyh/ask_reddit_whats_the_most_beautiful_piece_of/c26ny9/">https://www.reddit.com/r/programming/comments/26dyh/ask_reddit_whats_the_most_beautiful_piece_of/c26ny9/</a></p>
</li>
<li>
<p><a href="http://j.mp/python4Months">http://j.mp/python4Months</a> - and <a href="http://blog.agupieware.com/2014/01/benchmarks-teach-yourself-python-in.html">http://blog.agupieware.com/2014/01/benchmarks-teach-yourself-python-in.html</a></p>
</li>
<li>
<p><a href="https://www.reddit.com/r/programming/wiki/faq">https://www.reddit.com/r/programming/wiki/faq</a></p>
</li>
<li>
<p><a href="http://bit.ly/beginnerPython">http://bit.ly/beginnerPython</a> - easy video tutorials including for unittesting - <a href="http://j.mp/unittestVideo">http://j.mp/unittestVideo</a></p>
</li>
<li>
<p><a href="https://danieltakeshi.github.io/2013/07/05/ten-things-python-programmers-should-know/">https://danieltakeshi.github.io/2013/07/05/ten-things-python-programmers-should-know/</a></p>
</li>
<li>
<p><a href="https://www.quora.com/What-are-the-most-important-topics-to-learn-in-Python/answer/Janarthanan-S-1?srid=ul6v">https://www.quora.com/What-are-the-most-important-topics-to-learn-in-Python/answer/Janarthanan-S-1?srid=ul6v</a></p>
</li>
<li>
<p><a href="https://www.quora.com/What-is-an-ideal-checklist-to-learn-Python-in-30-days/answer/Janarthanan-S-1?srid=ul6v">https://www.quora.com/What-is-an-ideal-checklist-to-learn-Python-in-30-days/answer/Janarthanan-S-1?srid=ul6v</a> - explore Python in 30 days</p>
</li>
<li>
<p><a href="http://docs.python-guide.org/en/latest/intro/learning/">http://docs.python-guide.org/en/latest/intro/learning/</a></p>
</li>
<li>
<p><a href="https://stackoverflow.com/questions/2439638/in-what-order-should-the-python-concepts-be-explained-to-absolute-beginners">https://stackoverflow.com/questions/2439638/in-what-order-should-the-python-concepts-be-explained-to-absolute-beginners</a></p>
</li>
<li>
<p><a href="https://bitbucket.org/gregmalcolm/python_koans">https://bitbucket.org/gregmalcolm/python_koans</a> or <a href="https://github.com/gregmalcolm/python_koans">https://github.com/gregmalcolm/python_koans</a> - 289 koans to enlightenment!</p>
</li>
<li>
<p><a href="http://j.mp/pythonKoanVideo">http://j.mp/pythonKoanVideo</a></p>
</li>
<li>
<p><a href="http://www.learnpython.org/">http://www.learnpython.org/</a></p>
</li>
<li>
<p><a href="https://www.quora.com/How-does-Quincy-Larson-suggest-I-learn-to-code/answer/Quincy-Larson">https://www.quora.com/How-does-Quincy-Larson-suggest-I-learn-to-code/answer/Quincy-Larson</a></p>
<ul>
<li><a href="https://www.quora.com/What-is-a-step-by-step-procedure-to-become-a-GitHub-open-source-developer-for-a-complete-newbie-What-are-the-prerequisite-courses-I-should-take-and-how-should-I-choose-the-best-project-Also-please-suggest-some-projects-in-C++-Java/answer/Quincy-Larson">https://www.quora.com/What-is-a-step-by-step-procedure-to-become-a-GitHub-open-source-developer-for-a-complete-newbie-What-are-the-prerequisite-courses-I-should-take-and-how-should-I-choose-the-best-project-Also-please-suggest-some-projects-in-C++-Java/answer/Quincy-Larson</a>
<ul>
<li><a href="https://github.com/search?l=Python&amp;q=label%3Afirst-timers-only&amp;state=open&amp;type=Issues">https://github.com/search?l=Python&amp;q=label%3Afirst-timers-only&amp;state=open&amp;type=Issues</a></li>
</ul>
</li>
</ul>
</li>
<li>
<p><a href="https://www.quora.com/What-are-commonly-asked-Python-interview-questions">https://www.quora.com/What-are-commonly-asked-Python-interview-questions</a></p>
</li>
<li>
<p><a href="https://medium.com/@sebastienphl/a-practical-guide-to-learning-the-basics-of-web-programming-79961f3f3baa">https://medium.com/@sebastienphl/a-practical-guide-to-learning-the-basics-of-web-programming-79961f3f3baa</a></p>
</li>
<li>
<p>Learn by Doing (#6) - #6 Learn by doing: practice your programming skills and build real projects as soon as possible.</p>
<ul>
<li><a href="https://medium.com/@sebastienphl/a-practical-guide-to-learning-the-basics-of-web-programming-79961f3f3baa">https://medium.com/@sebastienphl/a-practical-guide-to-learning-the-basics-of-web-programming-79961f3f3baa</a>
<ul>
<li><a href="http://pythonpracticeprojects.com/">http://pythonpracticeprojects.com/</a></li>
<li><a href="http://javascriptissexy.com/how-to-learn-javascript-properly/">http://javascriptissexy.com/how-to-learn-javascript-properly/</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<p><strong>Table of Contents</strong></p>
<ul>
<li><a href="#important-concepts">Important Concepts</a>
<ul>
<li><a href="#0-types-and-their-attributes-aka-methods-unit-3">0. Types and their attributes (aka methods, Unit 3)</a></li>
<li><a href="#1-differentiate-between-parameters-and-arguments-unit-3">1. Differentiate between parameters and arguments (Unit 3)</a>
<ul>
<li><a href="#argument-definition">Argument Definition</a></li>
<li><a href="#parameter-definition">Parameter Definition</a></li>
</ul>
</li>
<li><a href="#2-explain-immutability-with-reference-to-the-various-data-types-in-python-unit-3">2. Explain Immutability with reference to the various data types in Python. (Unit 3)</a>
<ul>
<li><a href="#everything-is-an-object">Everything is an Object</a></li>
<li><a href="#what-is-id">What is ID?</a></li>
<li><a href="#what-is-value">What is value?</a></li>
<li><a href="#immutable-and-mutable">Immutable and Mutable</a></li>
</ul>
</li>
<li><a href="#3-what-is-list-comprehension-and-what-is-the-main-benefit-describe-with-an-example-unit-4">3. What is list comprehension and what is the main benefit? Describe with an example. (Unit 4)</a></li>
<li><a href="#4-slicing-as-an-object">4. Slicing as an Object</a></li>
<li><a href="#5-if-python-is-interpreted-what-are-pyc-files">5. If Python is interpreted, what are .pyc files?</a></li>
<li><a href="#6-a-string-is-a-recursive-data-structure-true-or-false">6. A String is a recursive data structure. True or False?</a></li>
<li><a href="#7-the-xor-trick-grokked-finally">7. The XOR trick, grokked, finally!</a>
<ul>
<li><a href="#credits">Credits</a></li>
</ul>
</li>
<li><a href="#8-packages-and-modules">8. Packages and Modules</a></li>
<li><a href="#9-how-to-maintain-a-sorted-list">9. How to maintain a sorted list?</a></li>
</ul>
</li>
<li><a href="#misc">Misc</a>
<ul>
<li><a href="#important-links">Important Links</a></li>
<li><a href="#the-best-3-books">The best 3 books</a></li>
<li><a href="#learn-by-example">Learn by Example</a>
<ul>
<li><a href="#what-standard-libraries-to-learn-in-python">What standard libraries to learn in Python?</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h1 id="important-concepts">Important Concepts</h1>
<p>What’s new in Python 3? Read <a href="https://github.com/crazyguitar/pysheeet/blob/master/docs/notes/python-new-py3.rst">this</a></p>
<p>[TOC]</p>
<h2 id="iterables">0.0 Iterables</h2>
<p>In Python, there are iterables and there are non-iterables. Which of the following is not an iterable?</p>
<ul>
<li><code>'abcdef'</code></li>
<li><code>range(100)</code></li>
<li><code>[1, 2, 3, 4, 55, 100]</code></li>
<li><code>[('a', 1), ('b', 2), ('c', 33)]</code></li>
<li><code>(('a'), ('b'), ('c'), ('a', 1), ('b', 2), ('c', 33))</code></li>
<li><code>zip(string.ascii_lowercase, range(26))</code></li>
<li><code>adict.keys()</code> where <code>adict</code> is a Python dictionary variable</li>
<li><code>adict.values()</code> where <code>adict</code> is a Python dictionary variable</li>
<li><code>{'a': 1, 'b': 2, 'c':3}</code></li>
<li><code>set(string.ascii_lowercase)</code></li>
<li><code>[[1, 2], [3], [4, 5, 6], [0]]</code></li>
</ul>
<h2 id="types-and-their-attributes-aka-methods-unit-3">0.1 Types and their attributes (aka methods, Unit 3)</h2>
<p>There are 4 main types in Python (string, tuples, list and dictionary). And across all of them, there are about 25 important attributes (methods) that help process/modify them. They are tabulated as follows:</p>
<table>
<thead>
<tr>
<th align="left">Type</th>
<th align="left">Attributes</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>__builtins__</code></td>
<td align="left"><strong><code>int</code></strong>, <strong><code>str</code></strong>, <strong><code>tuple</code></strong>, <strong><code>list</code></strong>, <strong><code>dict</code></strong>, <strong><code>len</code></strong>, <strong><code>sorted</code></strong>, <strong><code>del</code></strong></td>
</tr>
<tr>
<td align="left"><code>&lt;class 'str'&gt;</code></td>
<td align="left"><code>capitalize</code>, 1 <strong><code>count</code></strong>, <code>endswith</code>, 2 <strong><code>find</code></strong>, <code>format</code>, <code>index</code>, <code>isalnum</code>, 3 <strong><code>isalpha</code></strong>, <code>isdecimal</code>, <code>isdigit</code>, <code>islower</code>, <code>isnumeric</code>, <code>isspace</code>, <code>istitle</code>, <code>isupper</code>, 4 <strong><code>join</code></strong>, <code>ljust</code>, <code>lower</code>, <code>lstrip</code>, <code>replace</code>, 5 <strong><code>rfind</code></strong>, <code>rindex</code>, <code>rjust</code>, 6 <strong><code>split</code></strong>, <code>splitlines</code>, <code>startswith</code>, 7 <strong><code>strip</code></strong>, <code>swapcase</code>, <code>title</code>, <code>upper</code>, <code>zfill</code></td>
</tr>
<tr>
<td align="left"><code>&lt;class 'tuple'&gt;</code></td>
<td align="left">8 <strong><code>count</code></strong>, <code>index</code></td>
</tr>
<tr>
<td align="left"><code>&lt;class 'list'&gt;</code></td>
<td align="left">9 <strong><code>append</code></strong>, <code>clear</code>, <code>copy</code>, 10 <strong><code>count</code></strong>, 11 <strong><code>extend</code></strong>, <code>index</code>, 12 <strong><code>insert</code></strong>, 13 <strong><code>pop</code></strong>, 14 <strong><code>remove</code></strong>, 15 <strong><code>reverse</code></strong>, 16 <strong><code>sort</code></strong></td>
</tr>
<tr>
<td align="left"><code>&lt;class 'dict'&gt;</code></td>
<td align="left"><code>clear</code>, <code>copy</code>, <code>fromkeys</code>, 17 <strong><code>get</code></strong>, 18 <strong><code>items</code></strong>, 19 <strong><code>keys</code></strong>, 20 <strong><code>pop</code></strong>, <code>popitem</code>, <code>setdefault</code>, 21 <strong><code>update</code></strong>, 22 <strong><code>values</code></strong></td>
</tr>
<tr>
<td align="left"><code>&lt;_io.TextIOWrapper name='file1.txt' mode='r+' encoding='UTF-8'&gt;</code></td>
<td align="left">23 <strong><code>close</code></strong>, <code>fileno</code>, <code>flush</code>, 24 <strong><code>mode</code></strong>, <code>name</code>, 25 <strong><code>read</code></strong>, <code>readline</code>, <code>readlines</code>, <code>seek</code>, 26 <strong><code>write</code></strong>, <code>writelines</code></td>
</tr>
</tbody>
</table><h2 id="differentiate-between-parameters-and-arguments-unit-3">1. Differentiate between parameters and arguments (Unit 3)</h2>
<p><a href="http://j.mp/argsVsParams">http://j.mp/argsVsParams</a> - the official Python guide does not do justice. It is best to read this article here - <a href="http://stupidpythonideas.blogspot.in/2013/08/arguments-and-parameters.html">http://stupidpythonideas.blogspot.in/2013/08/arguments-and-parameters.html</a></p>
<p><img src="https://cdn.rawgit.com/kgisl/pythonFDP/7d9a152b/img/ArgumentsVsParameters.jpeg" alt="faqArg"></p>
<h3 id="argument-definition">Argument Definition</h3>
<p><a href="https://docs.python.org/3/glossary.html#term-argument">https://docs.python.org/3/glossary.html#term-argument</a><br>
<img src="https://cdn.rawgit.com/kgisl/pythonFDP/7d9a152b/img/argumentGlossary.jpeg" alt="argument"></p>
<h3 id="parameter-definition">Parameter Definition</h3>
<p><a href="https://docs.python.org/3/glossary.html#term-parameter">https://docs.python.org/3/glossary.html#term-parameter</a><br>
<img src="https://cdn.rawgit.com/kgisl/pythonFDP/7d9a152b/img/parameterGlossary.jpeg" alt="parameter"></p>
<p>What is the difference between arguments and parameters?</p>
<p>Parameters are defined by the names that appear in a function definition, whereas arguments are the values actually passed to a function when calling it. Parameters define what types of arguments a function can accept. For example, given the<br>
function definition:</p>
<pre class=" language-python"><code class="prism language-python"><span class="token keyword">def</span> <span class="token function">func</span> <span class="token punctuation">(</span>foo<span class="token punctuation">,</span> bar<span class="token operator">=</span><span class="token boolean">None</span><span class="token punctuation">,</span> <span class="token operator">**</span>kwargs<span class="token punctuation">)</span>
<span class="token keyword">pass</span>
</code></pre>
<p><code>foo</code>, <code>bar</code> and <code>wargs</code> are parameters of <code>func</code></p>
<p>However, when calling func for example <code>func(42, bar=314, extra=somevar)</code> the values 42 314, and somevar are arguments.</p>
<p><strong>argument</strong><br>
A value passed to a function (or method when calling the function. There are two kinds of arguments:</p>
<p><strong>keyword argument</strong>: an argument preceded by an identifier ( e.g. name in a function call). For example, 3 and 5 are both keyword arguments in the following calls to</p>
<pre><code>complex(real=3, imag=5)
</code></pre>
<p><strong>positional argument</strong>: an argument that is not a keyword argument. Positional arguments in the following calls:</p>
<pre><code> complex (3, 5)
</code></pre>
<p>Arguments are assigned to the named local variables (aka <em>parameters</em>) in a function body.</p>
<p><strong>parameters</strong><br>
A named entity in a function (or method) definition that specifies an argument (or in some cases, arguments that the function can accept. There are five kinds of parameters.</p>
<h2 id="explain-immutability-with-reference-to-the-various-data-types-in-python.-unit-3">2. Explain Immutability with reference to the various data types in Python. (Unit 3)</h2>
<h3 id="everything-is-an-object">Everything is an Object</h3>
<p><img src="https://cdn.rawgit.com/kgisl/pythonFDP/e7ccde61/img/whatIsObject.png" alt="object"></p>
<h3 id="what-is-id">What is ID?</h3>
<p><img src="https://cdn.rawgit.com/kgisl/pythonFDP/e7ccde61/img/whatIsID.png" alt="id"></p>
<h3 id="what-is-value">What is value?</h3>
<p><img src="https://cdn.rawgit.com/kgisl/pythonFDP/e7ccde61/img/whatIsValue.png" alt="value"></p>
<h3 id="immutable-and-mutable">Immutable and Mutable</h3>
<p><img src="https://cdn.rawgit.com/kgisl/pythonFDP/e7ccde61/img/pythonImmutable.png" alt="immutableP"><br>
<img src="https://cdn.rawgit.com/kgisl/pythonFDP/e7ccde61/img/pythonMutable.png" alt="mutableP"></p>
<p><img src="https://cdn.rawgit.com/kgisl/pythonFDP/3a8caff1/img/mutableCode.png" alt="mCode"> <img src="https://cdn.rawgit.com/kgisl/pythonFDP/3a8caff1/img/mutableOutput.png" alt="mOutput"></p>
<p><img src="https://cdn.rawgit.com/kgisl/pythonFDP/728f283e/img/mutablePython.png" alt="immutableTable"></p>
<h2 id="what-is-list-comprehension-and-what-is-the-main-benefit-describe-with-an-example.-unit-4">3. What is list comprehension and what is the main benefit? Describe with an example. (Unit 4)</h2>
<p><strong>Main benefit</strong>: Code is shorter and sometimes more clearer.</p>
<p><img src="https://cdn.rawgit.com/kgisl/pythonFDP/e3caa43d/img/explainListComprehension.png" alt="list_comprehension"></p>
<p><strong>Code Snippet</strong><br>
Lines <code>1-6</code> is equivalent to Lines <code>11-12</code> and equivalent to Line <code>17</code>.</p>
<p><img src="https://cdn.rawgit.com/kgisl/pythonFDP/9e101ddd/img/listComprehensionCode.png" alt="listCode"></p>
<p><strong>Output of Code Snippet</strong></p>
<p><img src="https://cdn.rawgit.com/kgisl/pythonFDP/020de846/img/listComprehensionOutput.jpg" alt="listOut"></p>
<h2 id="slicing-as-an-object">4. Slicing as an Object</h2>
<p><a href="https://docs.python.org/3/library/functions.html#slice">https://docs.python.org/3/library/functions.html#slice</a></p>
<p><img src="https://cdn.rawgit.com/kgisl/pythonFDP/7502044e/img/slicingAsObject.png" alt="slice"></p>
<h2 id="if-python-is-interpreted-what-are-.pyc-files">5. If Python is interpreted, what are .pyc files?</h2>
<p>"…it reminded me that seemingly trivial questions may have rather deep answers.” <a href="http://bit.ly/deepAnswer">http://bit.ly/deepAnswer</a></p>
<h2 id="a-string-is-a-recursive-data-structure.-true-or-false">6. A String is a recursive data structure. True or False?</h2>
<p><img src="https://cdn.rawgit.com/kgisl/pythonFDP/a5233884/img/stringAsRecursive.jpg" alt="stringRecursive"></p>
<p>Credit: <a href="https://twitter.com/dbader_org/status/874653012374859776">https://twitter.com/dbader_org/status/874653012374859776</a></p>
<p>Fun fact—Python <code>str</code> objects are <strong>recursive</strong> data structures: Each character in a string is a <code>str</code> of length 1 itself.</p>
<h2 id="the-xor-trick-grokked-finally">7. The XOR trick, grokked, finally!</h2>
<p>I have always wondered how the in-place <code>swap</code> worked using the XOR operation. The following <strong>table</strong> went a long way in helping clear up the magic in <em>my</em> head.</p>
<table>
<thead>
<tr>
<th>arg 1</th>
<th>arg 2</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>B</td>
<td>C</td>
<td>A</td>
</tr>
<tr>
<td>A</td>
<td>C</td>
<td>B</td>
</tr>
</tbody>
</table><p>Therefore,</p>
<pre><code>a = a ^ b # c value in a
b = a ^ b # b now contains a (since c ^ b -&gt; a)
a = a ^ b # a now contains b (since c ^ a -&gt; b)
</code></pre>
<h3 id="credits">Credits</h3>
<p><a href="http://www.brunton-spall.co.uk/post/2010/09/07/interview-questions-xor-trick-and-why-you-should-j/">http://www.brunton-spall.co.uk/post/2010/09/07/interview-questions-xor-trick-and-why-you-should-j/</a></p>
<h2 id="packages-and-modules">8. Packages and Modules</h2>
<blockquote>
<p><strong>tl;dr package</strong>: A Python module which can contain submodules or recursively, subpackages. Technically, a package is a Python module with an <strong>path</strong> attribute.</p>
</blockquote>
<blockquote>
<p><strong>tl; dr2</strong> Packages are modules too. They are just packaged up differently; they are formed by the combination of a directory plus <code>__init__.py</code> file. They are modules that can contain other modules.</p>
</blockquote>
<p>Any Python file is a <a href="http://docs.python.org/tutorial/modules.html">module</a>, its name being the file’s base name without the <code>.py</code> extension. A <a href="http://docs.python.org/tutorial/modules.html#packages">package</a> is a collection of Python modules: while a module is a single Python file, a package is a directory of Python modules containing an additional <code>__init__.py</code> file, to distinguish a package from a directory that just happens to contain a bunch of Python scripts. Packages can be nested to any depth, provided that the corresponding directories contain their own <code>__init__.py</code> file.</p>
<p>The distinction between module and package seems to hold just at the file system level. When you import a module or a package, the corresponding object created by Python is always of type <code>module</code>. Note, however, when you import a package, only variables/functions/classes in the <code>__init__.py</code> file of that package are directly visible, <em>not</em> sub-packages or modules. As an example, consider the <code>xml</code> package in the Python standard library: its <code>xml</code> directory contains an <code>__init__.py</code> file and four sub-directories; the sub-directory <code>etree</code> contains an <code>__init__.py</code> file and, among others, an <code>ElementTree.py</code> file. See what happens when you try to interactively import package/modules:</p>
<pre><code>&gt;&gt;&gt; import xml
&gt;&gt;&gt; type(xml)
&lt;type 'module'&gt;
&gt;&gt;&gt; xml.etree.ElementTree
Traceback (most recent call last):
File "&lt;stdin&gt;", line 1, in &lt;module&gt;
AttributeError: 'module' object has no attribute 'etree'
&gt;&gt;&gt; import xml.etree
&gt;&gt;&gt; type(xml.etree)
&lt;type 'module'&gt;
&gt;&gt;&gt; xml.etree.ElementTree
Traceback (most recent call last):
File "&lt;stdin&gt;", line 1, in &lt;module&gt;
AttributeError: 'module' object has no attribute 'ElementTree'
&gt;&gt;&gt; import xml.etree.ElementTree
&gt;&gt;&gt; type(xml.etree.ElementTree)
&lt;type 'module'&gt;
&gt;&gt;&gt; xml.etree.ElementTree.parse
&lt;function parse at 0x00B135B0&gt;
</code></pre>
<h2 id="how-to-maintain-a-sorted-list">9. How to maintain a sorted list?</h2>
<p>You need to maintain a list in sorted order without having to call <code>sort</code> each time an item is added to the list. How will you do this? <a href="http://j.mp/sortApply">http://j.mp/sortApply</a></p>
<h1 id="misc">Misc</h1>
<h2 id="important-links">Important Links</h2>
<p><a href="http://www.pixelmonkey.org/2015/06/06/pybooks">http://www.pixelmonkey.org/2015/06/06/pybooks</a><br>
<a href="https://www.safaribooksonline.com/library/view/python-in-a/9781491913833/">https://www.safaribooksonline.com/library/view/python-in-a/9781491913833/</a></p>
<p><a href="http://python-guide-pt-br.readthedocs.io/en/latest/intro/learning/">http://python-guide-pt-br.readthedocs.io/en/latest/intro/learning/</a></p>
<p>The best programming practice book!<br>
ByKevin Lon April 17, 2017<br>
Format: Paperback<br>
TL;DR: When it comes to programming practice, Elements of Programming interviews is the cream of the crop. If you are only going to buy one practice book, I would recommend this one above all the others. I have nothing but good things to say about the book, and can confidently say that no other product that offers as much depth as EoPI does.</p>
<p>The first thing you will notice about EoPI is that the level of detail is astounding; I was blown away by the sheer amount of effort that the authors put into it. The problem analysis is unparalleled, and goes far beyond basic algorithm/data structures knowledge. The solutions are easy to follow and explained very thoroughly. For example, if a problem has multiple solutions, the authors will walk you through each one and guide you towards the optimal solution. In addition to being a goldmine of commonly-asked problems, the book also offers many original problems that you wouldn’t be able to find anywhere else; it is by far the most comprehensive practice resource out there. In terms of organization the book is extremely well structured, and even provides study plans for the reader to help with problem selection. Some of the problems in the book are much more difficult than what you would find in an actual interview. If you are able to comfortably solve the problems in this book, you should certainly have no problem with the real thing.</p>
<p>Before using this book I tried various other resources, particularly Cracking the Coding Interview and LeetCode. The former offered no depth whatsoever: mostly simple and overused problems (like what you would get in a technical phone screen). While the latter provided no shortage of challenging problems, I found it sometimes frustrating to use because of its unclear problem statements and its reliance on an auto-grader to compensate for lack of published solutions and guidance.</p>
<p>I have long been a fan of the series and I am delighted to see that a Python version has been released. I give Elements of Programming Interviews 5-stars because I think it is an essential practice resource. Honestly, it was a lot of fun to work through the book; it was much more pleasant than the usual practice problem grind. Even if you are not practicing for interviews at the time, I highly recommend checking it out. It is a great way to develop your problem solving ability and build confidence for future interviews.</p>
<p><a href="https://www.amazon.com/dp/1537713949/ref=cm_wl_huc_continue">https://www.amazon.com/dp/1537713949/ref=cm_wl_huc_continue</a></p>
<h2 id="the-best-3-books">The best 3 books</h2>
<p>Python expertise awaits. Whether you are a pair of hackers building a prototype for a new startup; a 20-person team that is doing large-scale engineering with Python; or a thousand-person engineering department that is switching from Java/C++, your team will benefit greatly from copies of each of these!</p>
<ul>
<li>Python Essential Reference, 4e (Beazley)</li>
<li>Fluent Python, 1e (Ramalho)</li>
<li>Python Cookbook, 3e (Beazley, Jones)</li>
<li>Bonus: Python Cookbook, 2e (Martelli, Ascher)</li>
</ul>
<p>You’ll all be certified Pythonistas in no time. Welcome to the community, and Happy Hacking!</p>
<h2 id="learn-by-example">Learn by Example</h2>
<p><a href="https://doughellmann.com/blog/the-python-3-standard-library-by-example/">https://doughellmann.com/blog/the-python-3-standard-library-by-example/</a></p>
<h3 id="what-standard-libraries-to-learn-in-python">What standard libraries to learn in Python?</h3>
<p><a href="https://doughellmann.com/blog/the-python-3-standard-library-by-example/the-python-3-standard-library-by-example-table-of-contents/">https://doughellmann.com/blog/the-python-3-standard-library-by-example/the-python-3-standard-library-by-example-table-of-contents/</a></p>
<p><a href="http://my.safaribooksonline.com/book/programming/python/9780134291154">http://my.safaribooksonline.com/book/programming/python/9780134291154</a> - book TOC</p>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment