<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Python on The VikiD Truth</title><link>https://thevikidtruth.com/computing/category/python/</link><description>Recent content in Python on The VikiD Truth</description><generator>Hugo</generator><language>en</language><lastBuildDate>Thu, 22 Oct 2026 10:30:00 +0400</lastBuildDate><atom:link href="https://thevikidtruth.com/computing/category/python/index.xml" rel="self" type="application/rss+xml"/><item><title>Python spaCy NLP Library</title><link>https://thevikidtruth.com/computing/pythonspacy/</link><pubDate>Fri, 31 Mar 2023 14:47:25 +0400</pubDate><guid>https://thevikidtruth.com/computing/pythonspacy/</guid><description>&lt;p&gt;&lt;span class="missing-link"&gt;Python Libraries, tools and Links&lt;/span&gt; | &lt;a href="https://docs.python.org/3/" rel="noopener"&gt;Official Python Docs&lt;/a&gt;&#10;| &lt;a href="https://thevikidtruth.com/computing/intropygame/"&gt;Intro to Pygame&lt;/a&gt; | &lt;a href="https://thevikidtruth.com/computing/pythonspacy/"&gt;spaCy&lt;/a&gt;&lt;/p&gt;&#10;&lt;h1 id="python-spacy-nlp-library"&gt;Python spaCy NLP Library&lt;/h1&gt;&#10;&lt;p&gt;Here is the truth about spaCy: &lt;strong&gt;it is an industrial-strength Natural Language Processing library for Python that treats linguistic annotation as a pipeline of fast, composable components.&lt;/strong&gt; If you need to tokenise, tag, parse or recognise entities in real text, spaCy is the default workhorse.&lt;/p&gt;&#10;&lt;h3 id="what-it-is-in-plain-words"&gt;What it is, in plain words&lt;/h3&gt;&#10;&lt;p&gt;&lt;strong&gt;spaCy&lt;/strong&gt; (Explosion AI) provides:&lt;/p&gt;</description></item><item><title>Intro to Pygame Notes</title><link>https://thevikidtruth.com/computing/intropygame/</link><pubDate>Thu, 30 Mar 2023 23:23:52 +0400</pubDate><guid>https://thevikidtruth.com/computing/intropygame/</guid><description>&lt;p&gt;&lt;span class="missing-link"&gt;Python Libraries, tools and Links&lt;/span&gt; | &lt;a href="https://docs.python.org/3/" rel="noopener"&gt;Official Python Docs&lt;/a&gt;&#10;| &lt;a href="https://thevikidtruth.com/computing/intropygame/"&gt;Intro to Pygame&lt;/a&gt;&lt;/p&gt;&#10;&lt;h1 id="intro-to-pygame-notes"&gt;Intro to Pygame Notes&lt;/h1&gt;&#10;&lt;p&gt;Here is the truth about Pygame: &lt;strong&gt;it is a friendly box of SDL bindings that lets Python draw pixels, play sounds and read joysticks – enough to make real games without a 3D engine.&lt;/strong&gt; If you can write a loop and blit a surface, you can ship a game.&lt;/p&gt;&#10;&lt;h3 id="what-it-is-in-plain-words"&gt;What it is, in plain words&lt;/h3&gt;&#10;&lt;p&gt;&lt;strong&gt;Pygame&lt;/strong&gt; is a community library wrapping &lt;strong&gt;SDL2&lt;/strong&gt; for Python. It gives you:&lt;/p&gt;</description></item><item><title>Python Keywords</title><link>https://thevikidtruth.com/computing/pykeywords/</link><pubDate>Sun, 05 Sep 2021 05:50:54 +0400</pubDate><guid>https://thevikidtruth.com/computing/pykeywords/</guid><description>&lt;p&gt;&lt;a href="https://thevikidtruth.com/computing/computingfreedom/"&gt;computingFreedom&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/bciyh/"&gt;Build&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/picolisp/"&gt;Picolisp&lt;/a&gt; | &lt;a href="https://thevikidtruth.com/computing/pilmachine/"&gt;Picolisp Machine&lt;/a&gt; | &lt;span class="missing-link"&gt;pil sources&lt;/span&gt; |&#10;&lt;span class="missing-link"&gt;Linux&lt;/span&gt; | &lt;span class="missing-link"&gt;BASH&lt;/span&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/cprogramming/"&gt;C Programmming&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/os/"&gt;Operating Systems&lt;/a&gt; |&#10;&lt;span class="missing-link"&gt;Javascipt&lt;/span&gt; |&#10;&lt;span class="missing-link"&gt;Emacs&lt;/span&gt; | &lt;a href="https://thevikidtruth.com/computing/vim/"&gt;vim&lt;/a&gt; |&#10;&lt;span class="missing-link"&gt;Pharo Smalltalk&lt;/span&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/computersecurity/"&gt;Computer Security&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/python/"&gt;Python&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/rasberrypi/"&gt;RasberryPi&lt;/a&gt; |&lt;/p&gt;&#10;&lt;h1 id="python-keywords"&gt;Python Keywords&lt;/h1&gt;&#10;&lt;p&gt;Here is the truth about Python keywords: &lt;strong&gt;there are only a few dozen of them, they are the grammar of the language, and you cannot use them as names.&lt;/strong&gt; Everything else is a builtin or an ordinary identifier.&lt;/p&gt;&#10;&lt;h3 id="what-it-is-in-plain-words"&gt;What it is, in plain words&lt;/h3&gt;&#10;&lt;p&gt;A &lt;strong&gt;keyword&lt;/strong&gt; (reserved word) is a token the Python parser treats specially. As of Python 3.12/3.13 the set includes:&lt;/p&gt;</description></item><item><title>iPython</title><link>https://thevikidtruth.com/computing/ipython/</link><pubDate>Sat, 03 Dec 2016 00:34:08 +0400</pubDate><guid>https://thevikidtruth.com/computing/ipython/</guid><description>&lt;p&gt;&lt;a href="https://thevikidtruth.com/computing/computingfreedom/"&gt;computingFreedom&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/bciyh/"&gt;Build&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/picolisp/"&gt;Picolisp&lt;/a&gt; | &lt;a href="https://thevikidtruth.com/computing/pilmachine/"&gt;Picolisp Machine&lt;/a&gt; | &lt;span class="missing-link"&gt;pil sources&lt;/span&gt; |&#10;&lt;span class="missing-link"&gt;Linux&lt;/span&gt; | &lt;span class="missing-link"&gt;BASH&lt;/span&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/cprogramming/"&gt;C Programmming&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/os/"&gt;Operating Systems&lt;/a&gt; |&#10;&lt;span class="missing-link"&gt;Javascipt&lt;/span&gt; |&#10;&lt;span class="missing-link"&gt;Emacs&lt;/span&gt; | &lt;a href="https://thevikidtruth.com/computing/vim/"&gt;vim&lt;/a&gt; |&#10;&lt;span class="missing-link"&gt;Pharo Smalltalk&lt;/span&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/computersecurity/"&gt;Computer Security&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/python/"&gt;Python&lt;/a&gt; |&lt;/p&gt;&#10;&lt;h1 id="ipython"&gt;iPython&lt;/h1&gt;&#10;&lt;p&gt;Here is the truth about IPython: &lt;strong&gt;the best place to learn Python is not a file – it&amp;rsquo;s a prompt that remembers what you just did, shows you plots, and lets you edit the last thought.&lt;/strong&gt; IPython is that prompt, and Jupyter is the notebook built around it.&lt;/p&gt;</description></item><item><title>SciPy</title><link>https://thevikidtruth.com/computing/scipy/</link><pubDate>Sat, 03 Dec 2016 00:30:25 +0400</pubDate><guid>https://thevikidtruth.com/computing/scipy/</guid><description>&lt;p&gt;&lt;a href="https://thevikidtruth.com/computing/computingfreedom/"&gt;computingFreedom&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/bciyh/"&gt;Build&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/picolisp/"&gt;Picolisp&lt;/a&gt; | &lt;a href="https://thevikidtruth.com/computing/pilmachine/"&gt;Picolisp Machine&lt;/a&gt; | &lt;span class="missing-link"&gt;pil sources&lt;/span&gt; |&#10;&lt;span class="missing-link"&gt;Linux&lt;/span&gt; | &lt;span class="missing-link"&gt;BASH&lt;/span&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/cprogramming/"&gt;C Programmming&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/os/"&gt;Operating Systems&lt;/a&gt; |&#10;&lt;span class="missing-link"&gt;Javascipt&lt;/span&gt; |&#10;&lt;span class="missing-link"&gt;Emacs&lt;/span&gt; | &lt;a href="https://thevikidtruth.com/computing/vim/"&gt;vim&lt;/a&gt; |&#10;&lt;span class="missing-link"&gt;Pharo Smalltalk&lt;/span&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/computersecurity/"&gt;Computer Security&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/python/"&gt;Python&lt;/a&gt; |&lt;/p&gt;&#10;&lt;h1 id="scipy"&gt;SciPy&lt;/h1&gt;&#10;&lt;p&gt;Here is the truth about SciPy: &lt;strong&gt;it is the standard library Python never shipped for science and engineering.&lt;/strong&gt; Where NumPy gives you arrays, SciPy gives you the algorithms that &lt;em&gt;use&lt;/em&gt; them – integration, optimisation, signal processing, statistics, sparse linear algebra and more.&lt;/p&gt;&#10;&lt;h3 id="what-it-is-in-plain-words"&gt;What it is, in plain words&lt;/h3&gt;&#10;&lt;p&gt;&lt;strong&gt;SciPy&lt;/strong&gt; (pronounced &amp;ldquo;sigh pie&amp;rdquo;) is an open-source Python library built on &lt;a href="https://thevikidtruth.com/computing/numpy/"&gt;NumPy&lt;/a&gt;. It collects battle-tested implementations of classical numerical methods, many of them wrappers around the same Fortran and C libraries (QUADPACK, FFTpACK, ARPACK, ODEPACK, LAPACK) that scientists have trusted for decades. The top-level packages you&amp;rsquo;ll actually import:&lt;/p&gt;</description></item><item><title>NumPy</title><link>https://thevikidtruth.com/computing/numpy/</link><pubDate>Sat, 03 Dec 2016 00:29:14 +0400</pubDate><guid>https://thevikidtruth.com/computing/numpy/</guid><description>&lt;p&gt;&lt;a href="https://thevikidtruth.com/computing/computingfreedom/"&gt;computingFreedom&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/bciyh/"&gt;Build&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/picolisp/"&gt;Picolisp&lt;/a&gt; | &lt;a href="https://thevikidtruth.com/computing/pilmachine/"&gt;Picolisp Machine&lt;/a&gt; | &lt;span class="missing-link"&gt;pil sources&lt;/span&gt; |&#10;&lt;span class="missing-link"&gt;Linux&lt;/span&gt; | &lt;span class="missing-link"&gt;BASH&lt;/span&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/cprogramming/"&gt;C Programmming&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/os/"&gt;Operating Systems&lt;/a&gt; |&#10;&lt;span class="missing-link"&gt;Javascipt&lt;/span&gt; |&#10;&lt;span class="missing-link"&gt;Emacs&lt;/span&gt; | &lt;a href="https://thevikidtruth.com/computing/vim/"&gt;vim&lt;/a&gt; |&#10;&lt;span class="missing-link"&gt;Pharo Smalltalk&lt;/span&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/computersecurity/"&gt;Computer Security&lt;/a&gt; |&#10;&lt;a href="https://thevikidtruth.com/computing/python/"&gt;Python&lt;/a&gt; |&lt;/p&gt;&#10;&lt;h1 id="numpy"&gt;NumPy&lt;/h1&gt;&#10;&lt;p&gt;Here is the truth that makes Python fast at maths: &lt;strong&gt;the maths isn&amp;rsquo;t actually done in Python.&lt;/strong&gt; NumPy hands whole arrays to compiled C (and Fortran-descended) code in one go, and that single idea – think in arrays, not loops – is what makes the whole scientific Python world possible.&lt;/p&gt;</description></item><item><title>Python Language Notes</title><link>https://thevikidtruth.com/computing/python/</link><pubDate>Sun, 27 Nov 2016 21:45:02 +0400</pubDate><guid>https://thevikidtruth.com/computing/python/</guid><description>&lt;p&gt;&lt;span class="missing-link"&gt;Python Libraries, tools and Links&lt;/span&gt; | &lt;a href="https://docs.python.org/3/" rel="noopener"&gt;Official Python Docs&lt;/a&gt;&#10;| &lt;a href="https://thevikidtruth.com/computing/intropygame/"&gt;Intro to Pygame&lt;/a&gt; | &lt;a href="https://thevikidtruth.com/computing/pythonspacy/"&gt;spaCy&lt;/a&gt;&lt;/p&gt;&#10;&lt;h1 id="python-language-notes"&gt;Python Language Notes&lt;/h1&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Lexical Analysis&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://thevikidtruth.com/computing/pykeywords/"&gt;Keywords&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;name ::= lc_letter (lc_letter | &amp;#34;_&amp;#34;)*&#10;lc_letter ::= &amp;#34;a&amp;#34;...&amp;#34;z&amp;#34;&#10;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;1. **Operators and Builtin Functions**&#10;1. 1. **All Types**&#10; 1. ```&#10; type(obj) --&amp;gt; type object&#10; ```&#10; 1. ```&#10; isinstance(obj, typ) --&amp;gt; bool&#10; ```&#10; 1. ```&#10; repr(obj) #evaluatable representation&#10; ```&#10; 1. ```&#10; str(obj) #printable representation&#10; ```&#10; 1. ```&#10; is, is not # are two objects the same&#10; ```&#10;1. - **All Numeric Types**&#10; - - ` abs(-1) # 1`&#10; - ` chr(65) #&amp;#39;A&amp;#39; `&#10; - ` ord(&amp;#39;A&amp;#39;)#65 `&#10; - ` complex(1) #(1+0j) `&#10; - ` divmod(25,7) #(3,4) `&#10; - ` pow(2,8) #256 `&#10; - ` round(2.75,1) #2.8, rounds up `&#10;1. **Objects**&#10;1. ```&#10;int, float, bool, dict, set, tuple, str, bytes&#10; None&#10;&lt;/code&gt;&lt;/pre&gt;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Classification&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Primative, Numeric, Sequence, Container: Can contain other types, Collection&lt;/li&gt;&#10;&lt;li&gt;Common use cases&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Dictionaries for lookups&#10;&lt;ul&gt;&#10;&lt;li&gt;Tuples for data that is invariant at runtime&lt;/li&gt;&#10;&lt;li&gt;Lists for dynamic runtime data&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Primative Types&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;bool&lt;/strong&gt; -&amp;gt; &lt;code&gt;True, False&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;bool(float(&amp;quot;NaN&amp;quot;)) --&amp;gt; True&lt;/code&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;bool(0.0) --&amp;gt; False&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;bool(0) --&amp;gt; False&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;bool([]) --&amp;gt; False&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;int&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;2**31 - 1&lt;/code&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;binary: &lt;code&gt;0b10&lt;/code&gt;, &lt;code&gt;bin(20) #'0b10100'&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;octal: &lt;code&gt;0o77&lt;/code&gt;, &lt;code&gt;oct(20) #'0o24&amp;quot;&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;hex: &lt;code&gt;0xFF&lt;/code&gt;, &lt;code&gt;hex(20) #'0x14'&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt; int(3.5); int(&amp;quot;3.5&amp;quot;); int(&amp;quot;1111&amp;quot;, 1) --&amp;gt; 15&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt; abs(-1)&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt; 1//3 #0, integer division&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;float&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;1.41&lt;/code&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;3e-5&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;float(3), float(&amp;quot;3.14&amp;quot;)&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt; float(&amp;quot;nan&amp;quot;), float(&amp;quot;inf&amp;quot;), float(&amp;quot;-inf&amp;quot;)&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;: {round(1.234, 2)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Complex&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;complex(2,3) #(2+3j)&#10;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;1. **Sequence** (Builtin Functions)&#10;1. `len(obj)`&#10;1. - **character** (char): `ord(char)` --&amp;gt; int&#10; - **strings**&#10; - ```&#10; help(str)&#10; &amp;gt;&amp;gt;&amp;gt; m = &amp;#34;&amp;#34;&amp;#34;This is&#10; ... a multiline&#10; ... string&amp;#34;&amp;#34;&amp;#34;&#10; &amp;#39;This is\na multiline\nstring&amp;#39;&#10; print(m)&#10; str(666)&#10; &amp;#34;Vi er så glad for å høre og lære om Python!&amp;#34; # &amp;#39;Vi er så glad for å høre og lære om Python!&amp;#39;&#10; &amp;#34;Vi er s\u00e5 glad for \u00e5 h\xf8re og l\u00e6re om Python!&amp;#34; &amp;#39; #Vi er så glad for å høre og lære om Python!&amp;#39;&#10; ```&#10; - ```&#10; &amp;#39;\\xe5&amp;#39;&#10; &amp;#39;å&amp;#39; &#10; ```&#10; - ```&#10; &amp;#39;\\345&amp;#39; &amp;#39;å&amp;#39;&#10; ```&#10; - ```&#10; str.title(), str.upper(), str.lower, str.lstrip(), .rstrip, .strip&#10; var = &amp;#39;in&amp;#39;&#10; print(f&amp;#34;I am {var} trouble!&amp;#34;)&#10; ```&#10; - **f**&#10; - raw strings `r&amp;#39;this is t raw&amp;#39;`&#10; - - implicit concatantion `&amp;#34;hello&amp;#34; &amp;#34;world&amp;#34;`&#10; - bytes `b&amp;#39;this is a byte string&amp;#39;`&#10; - ```&#10; b&amp;#39;this is a byte string&amp;#39;.split()&#10; [b&amp;#39;this&amp;#39;, b&amp;#39;is&amp;#39;, b&amp;#39;a&amp;#39;, b&amp;#39;byte&amp;#39;, b&amp;#39;string&amp;#39;]&#10; &amp;#34;Vi er så glad for &amp;#34;.encode(&amp;#39;utf-8&amp;#39;)&#10; b&amp;#39;Vi er sa\\xcc\\x8a glad for &amp;#39;.decode(&amp;#39;utf-8&amp;#39;)&#10; ```&#10; - **bytearray**&#10; - **tuple**&#10; - ```&#10; (1,2)&#10; (False, 1, &amp;#39;c&amp;#39;)&#10; (2,) + (9,) =&amp;gt; (2,9)&#10; ```&#10; - **Lists**&#10; - ```&#10; [1,2,3]&#10; [True, False, &amp;#39;7&amp;#39;]&#10; ```&#10; - ```&#10; append(x), count(x), extend(L), index(x), insert(x), insert(i,x), pop(x), remove(x), reverse(), sort()&#10; ```&#10; - ```&#10; alist = [0, 1, 2, 3]&#10; del alist[2] #[0, 1, 3]&#10; ```&#10; - **slice**&#10; - ```&#10; mylist[:]&#10; ```&#10; - - **Sorting Lists**&#10; - ```&#10; sorted() #generate a copy&#10; sort&#10; sorted(x, reverse=True)&#10; reverse()&#10; ```&#10; - **Numerical Lists**&#10; - ` range() `&#10; - ```&#10; list(range(5))&#10; list(range(5,11))&#10; nums = []&#10; for exp in range(5):&#10; nums.append(2**exp)&#10; ```&#10; - **List Comprehensions**&#10; - ```&#10; [2**exp for exp in range(5)]&#10; ```&#10; - ` [i**3 for i in range(10) if True] `&#10; - ```&#10; f = open(&amp;#34;test.txt&amp;#34;, &amp;#39;r&amp;#39;)&#10; data = [line.strip for line in f]&#10; f.close()&#10; # now process data&#10; ```&#10; - **Generator Expressions**&#10; - *list comprensions*&#10; - ```&#10; f = open(&amp;#34;test.txt&amp;#34;, &amp;#39;r&amp;#39;)&#10; data = (line.strip for line in f)&#10; #now process data before closing the file!&#10; f.close()&#10; ```&#10; - **dictionary**&#10; - ` {key:value}`&#10; - ` &amp;#39;key&amp;#39; in dict `&#10; - ```&#10; states = {&#10; &#9;&amp;#39;ca&amp;#39;: &amp;#39;California&amp;#39;,&#10; &#9;&amp;#39;il&amp;#39;: &amp;#39;Illinois&amp;#39;,&#10; &#9;&amp;#39;fl&amp;#39;: &amp;#39;florida&amp;#39;,&#10; &#9;}&#10; states[&amp;#39;ca&amp;#39;]&#10; states.get(&amp;#39;xx&amp;#39;, &amp;#39;default value&amp;#39;) # equivalant to: states[&amp;#39;xx&amp;#39;] if &amp;#39;xx&amp;#39; in states else &amp;#39;default value&amp;#39;&#10; states.setdefault(&amp;#39;xx&amp;#39;, &amp;#39;default value&amp;#39;) #in not there set and return the key.&#10; states[&amp;#39;ny&amp;#39;] = &amp;#39;New York&amp;#39;&#10; del states[&amp;#39;il&amp;#39;]&#10; states.values() #dict_values([...]), &amp;lt;class &amp;#39;dict_values&amp;#39;&amp;gt;&#10; states.items()&#10; states.keys()&#10; ```&#10; - ```&#10; has_key(), keys(), values(), dict.items(), clear(), copy(), update(x), get(x,[y])&#10; ```&#10; - **Set**&#10; - ` {1,2,3}`&#10; - ```&#10; s = set()&#10; s.add(1)&#10; s.add(&amp;#39;foo&amp;#39;)&#10; t = set()&#10; s | t #union of t &amp;amp; s&#10; ```&#10; - *Set Comprehensions*&#10; - ```&#10; odd = \{i for i in range(10) if i % 2\}&#10; ```&#10; - **Frozenset**&#10; - **Complex**&#10;1. **Modules and Packages**&#10;1. - **Modules**&#10; - ```&#10; import module&#10; import module as mod&#10; from module import specific_function&#10; ```&#10; - **Packages**&#10; - *maps*&#10; - ```&#10; maps/&#10; __init__.py&#10; cities.py&#10; navigation.py&#10; gpsdata.py&#10; ```&#10; - **__init__.py**&#10; - ```&#10; import maps &#10; ```&#10; - ```&#10; maps.navigation.turn_right() &#10; ```&#10;1. **Standard Library / Types**&#10;1. - **math**&#10; - ```&#10; import math&#10; math.sqrt(16)&#10; PI = math.pi&#10; math.sin(PI)&#10; math.log(1000, 10)&#10; ```&#10; - **Fraction**&#10; - **Decimal**&#10; - **Date**&#10; - **Array**&#10; - **range**&#10; - ```&#10; range(5)&#10; ```&#10;1. **Converstion Functions**&#10;1. - `int, float, bool, str, tuple, list, dict, set`&#10; - `chr(int)` --&amp;gt; char&#10;1. **Operators**&#10;1. - ` + 1 * ** / // % `&#10; - ` ~ &amp;gt;&amp;gt; &amp;lt;&amp;lt; &amp;amp; ^ | `&#10; - ` &amp;lt; &amp;gt; &amp;lt;= &amp;gt;= &amp;lt;&amp;gt; != == `&#10; - ` and, or, not `&#10; - ```&#10; &amp;lt;string | list&amp;gt; + &amp;lt;string | list&amp;gt;&#10; &amp;#39;five&amp;#39; + &amp;#39;four&amp;#39;&#10; &amp;lt;int&amp;gt; * &amp;lt;string | list&amp;gt;&#10; &amp;lt;obj&amp;gt; in &amp;lt;seq&amp;gt;&#10; ```&#10; - **Function application**&#10; - ` function(args...)`&#10; - **Indexing**&#10; - ` seq[index | range] `&#10; - **Lookup (dictionaries)**&#10; - ` d[key] `&#10;1. **Expressions**&#10;1. ```&#10; Operator Precedence&#10;| no. | operators | description |&#10;| 1 | f(...) | function application |&#10;| 2 | o[l] | index lookups |&#10;| 3 | o.f(...) | method call |&#10;| 4 | ** | exponentiation |&#10;| 5 | -N | sign change |&#10;| 6 | *,/,//,% | numeric |&#10;| 7 | +,- | numeric |&#10;| 8 | &amp;lt;, &amp;lt;=, ... | comparisons |&#10;| 9 | in, not in | membership |&#10;| 10 | not o | logical |&#10;| 11 | and 0 | logical |&#10;| 12 | or | logical |&#10;&lt;/code&gt;&lt;/pre&gt;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Rules for Well-formedness&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;R1&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt; Every Value is well formed&#10;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;li&gt;R2 (E)&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt; if E is well formed then (E) is well formed&#10;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;li&gt;R3 &lt;code&gt;&amp;lt;uop&amp;gt; E&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt; &amp;lt;uop&amp;gt; is a unary operation&#10; if E, then &amp;lt;uop&amp;gt; E is well formed&#10;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;li&gt;R4 &lt;code&gt;E1 &amp;lt;bop&amp;gt; E2&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt; &amp;lt;bop&amp;gt; is a binary operation&#10; if E1, E2, then E1 &amp;lt;bop&amp;gt; E2&#10;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;li&gt;R5 E1[E2]&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt; if E1, E2, the E1[E2]&#10;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;li&gt;R6 F(A, &amp;hellip;)&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt; if F is a function with A, A1, A2, ... expressions&#10; then F(), F(A), F(A, A1), F(A, A1, A2), ...&#10;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;li&gt;R7 if O.f(E)&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt; if O, f, E, E1, ...&#10; then O.f(), O.f(E), O.f(E, E1), ...&#10;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Printing&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;print(&amp;#34;hello&amp;#34;, &amp;#39;how&amp;#39;)&#10;print(&amp;#34;hello&amp;#34;, end=&amp;#39;&amp;#39;)&#10;from pprint import *&#10;pprint(expressions)&#10;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;1. **Functions**&#10;1. *anonymous*&#10;1. - **lambda**&#10; - ```&#10; lambda x: x&#10; ```&#10; - **def**&#10; - ```&#10; def f(x,y):&#10; return x + y&#10; ```&#10; - ```&#10; def h():&#10; &amp;#34;hello&amp;#34;&#10; #This function returns None&#10; h() #None&#10; ```&#10; - **keyword**&#10; - ```&#10; def f(x=0, y=0):&#10; print(&amp;#34;x = &amp;#34;, x, &amp;#34;y = &amp;#34;, y)&#10; return (x, y)&#10; f(x=1, 2)&#10; f()&#10; f(1)&#10; ```&#10; - **Destructuring with Tuples**&#10; - *positional*&#10; - ```&#10; def ff(*a):&#10; print(&amp;#34;first = &amp;#34;, a[0], &amp;#34;Second = &amp;#34;, a[1])&#10; return (len(a), a)&#10; ```&#10; - **Destructuring with Dictionaries**&#10; - ```&#10; def fff(**a):&#10; print(a[&amp;#34;first&amp;#34;])&#10; return a&#10; ```&#10; - **destructuring with both**&#10; - ```&#10; def g(*a,**b):&#10; return (a,b)&#10; ```&#10;1. **Methods**&#10;1. ```&#10; x+1&#10; [is actually]&#10; x.__add__(1)&#10;&lt;/code&gt;&lt;/pre&gt;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Magic Methods&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;__add__(self, y) # x + y&#10;__sub__(self, y) # x - y&#10;__mul__(self, y) # x * y&#10;__mod__(self, y) # x % y&#10;__neg__(self) # -x&#10;__eq__(self, y) # x == y&#10;__ge__(self, y) # x &amp;gt;= y&#10;__gt__(self, y) # x &amp;gt; y&#10;__lt__(self, y) # x &amp;lt; y&#10;__le__(self, y) # x &amp;lt;= y&#10;__ne__(self, y) # x != y&#10;__contains__(self,y) # y in x&#10;__getitem__(self, y) # x[y]&#10;__setitem__(self, i, y) # x[i] = y&#10;__hash__(self) # hash(x)&#10;__int__(self) # int(x)&#10;__iter__(self) # for y in x&#10;__len__(self) # len(x)&#10;__repr__(self) # repr(x)&#10;__str__(self) # str(x)&#10;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Some Builtins&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;abs, min, max&#10;type&#10;len&#10;dir&#10;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;gives internal dictionary of names&lt;/p&gt;</description></item></channel></rss>