Skip to content

Commit

Permalink
link to threads about variable naming
Browse files Browse the repository at this point in the history
  • Loading branch information
joelchan committed Jan 30, 2024
1 parent 173963d commit 4abdbc4
Show file tree
Hide file tree
Showing 78 changed files with 3,489 additions and 499 deletions.
Binary file modified .DS_Store
Binary file not shown.
166 changes: 81 additions & 85 deletions 10_Pandas-1.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 11_Pandas-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -2284,7 +2284,7 @@ <h5>What’s happening under the hood<a class="headerlink" href="#what-s-happeni
<div class="cell_output docutils container">
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
<span class="ne">KeyError</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
<span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">folders</span><span class="o">/</span><span class="n">xz</span><span class="o">/</span><span class="n">_hjc5hsx743dclmg8n5678nc0000gn</span><span class="o">/</span><span class="n">T</span><span class="o">/</span><span class="n">ipykernel_5880</span><span class="o">/</span><span class="mf">3685041712.</span><span class="n">py</span> <span class="ow">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
<span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">folders</span><span class="o">/</span><span class="n">xz</span><span class="o">/</span><span class="n">_hjc5hsx743dclmg8n5678nc0000gn</span><span class="o">/</span><span class="n">T</span><span class="o">/</span><span class="n">ipykernel_30808</span><span class="o">/</span><span class="mf">3685041712.</span><span class="n">py</span> <span class="ow">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
<span class="ne">----&gt; </span><span class="mi">1</span> <span class="n">courses</span> <span class="o">=</span> <span class="n">courses</span><span class="o">.</span><span class="n">drop</span><span class="p">(</span><span class="n">columns</span><span class="o">=</span><span class="s2">&quot;has_intro&quot;</span><span class="p">)</span>
<span class="g g-Whitespace"> </span><span class="mi">2</span> <span class="n">courses</span><span class="o">.</span><span class="n">head</span><span class="p">()</span>

Expand Down
85 changes: 85 additions & 0 deletions 2a_Expressions.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,96 @@ <h1 class="site-logo" id="site-title">INST126 Lecture Notes</h1>
2b: Variables
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="3_Functions.html">
3: Functions
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="4_Conditionals.html">
4: Conditionals
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="5_Lists.html">
5: Lists
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="6_Iteration.html">
6: Iteration
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="7_Strings.html">
7: Strings
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="8_Dictionaries.html">
8: Dictionaries
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="9_Files.html">
9: Files
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="10_Pandas-1.html">
10: Pandas for data analysis with Python: Part 1
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="11_Pandas-2.html">
11: Pandas for data analysis with Python: Part 2
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Problem-Formulation.html">
Problem Formulation
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Debugging-Helpseeking.html">
Debugging and Help-Seeking
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Help-Seeking-Template.html">
Help-Seeking Template
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="example-course-copier.html">
Sample program(s): course code filtering
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Conditionals.html">
Practice: Conditionals
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Module-2_Lists.html">
Practice: Lists
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Module-1-Projects.html">
Practice: Module 1 Project (Conditional Functions)
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Module-2-Projects.html">
Practice: Module 2 Project (Lists, Iteration, Strings)
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Debugging_examples.html">
Practice: Debugging
</a>
</li>
</ul>

</div>
Expand Down
88 changes: 85 additions & 3 deletions 2b_Variables.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<script async="async" src="_static/sphinx-thebe.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Week 3 - Day 1 - Functions" href="3_Functions.html" />
<link rel="next" title="3: Functions" href="3_Functions.html" />
<link rel="prev" title="2a: Expressions" href="2a_Expressions.html" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="docsearch:language" content="None">
Expand Down Expand Up @@ -126,14 +126,94 @@ <h1 class="site-logo" id="site-title">INST126 Lecture Notes</h1>
</li>
<li class="toctree-l1">
<a class="reference internal" href="3_Functions.html">
Week 3 - Day 1 - Functions
3: Functions
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="4_Conditionals.html">
4: Conditionals
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="5_Lists.html">
5: Lists
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="6_Iteration.html">
6: Iteration
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="7_Strings.html">
7: Strings
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="8_Dictionaries.html">
8: Dictionaries
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="9_Files.html">
9: Files
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="10_Pandas-1.html">
10: Pandas for data analysis with Python: Part 1
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="11_Pandas-2.html">
11: Pandas for data analysis with Python: Part 2
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Problem-Formulation.html">
Problem Formulation
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Debugging-Helpseeking.html">
Debugging and Help-Seeking
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Help-Seeking-Template.html">
Help-Seeking Template
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="example-course-copier.html">
Sample program(s): course code filtering
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Conditionals.html">
Practice: Conditionals
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Module-2_Lists.html">
Practice: Lists
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Module-1-Projects.html">
Practice: Module 1 Project (Conditional Functions)
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Module-2-Projects.html">
Practice: Module 2 Project (Lists, Iteration, Strings)
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Debugging_examples.html">
Practice: Debugging
</a>
</li>
</ul>

</div>
Expand Down Expand Up @@ -1026,6 +1106,8 @@ <h3>Semantics<a class="headerlink" href="#semantics" title="Permalink to this he
<p><code class="docutils literal notranslate"><span class="pre">tipAmount</span> <span class="pre">=</span> <span class="pre">tipRate</span> <span class="pre">*</span> <span class="pre">(baseAmount</span> <span class="pre">+</span> <span class="pre">baseAmount*taxRate)</span></code></p>
</div>
<p>Again, these are the same exact programs, from Python’s perspective! The variable names make all the difference.</p>
<p>Just for fun, you can read some programming horror stories about variable naming <a class="reference external" href="https://www.reddit.com/r/programminghorror/comments/251nsl/bad_variable_names/">here</a>.</p>
<p>And see <a class="reference external" href="https://stackoverflow.com/questions/454178/what-is-readable-code-what-are-the-best-practices-to-follow-while-naming-variab">this StackOverflow thread</a> for discussion of the importance of variable naming (in the context of discussing code readability, a central thing we care about it in this class, enough to make it a rubric item on your Projects!). The thread includes some links to style guides from Microsof, Python, and other sources.</p>
</section>
</section>
<section id="the-nameerror">
Expand Down Expand Up @@ -1095,7 +1177,7 @@ <h2>The <code class="docutils literal notranslate"><span class="pre">NameError</
<a class='right-next' id="next-link" href="3_Functions.html" title="next page">
<div class="prev-next-info">
<p class="prev-next-subtitle">next</p>
<p class="prev-next-title">Week 3 - Day 1 - Functions</p>
<p class="prev-next-title">3: Functions</p>
</div>
<i class="fas fa-angle-right"></i>
</a>
Expand Down
88 changes: 84 additions & 4 deletions 3_Functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<script async="async" src="_static/sphinx-thebe.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Sample program(s): course code filtering" href="example-course-copier.html" />
<link rel="next" title="4: Conditionals" href="4_Conditionals.html" />
<link rel="prev" title="2b: Variables" href="2b_Variables.html" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="docsearch:language" content="None">
Expand Down Expand Up @@ -129,11 +129,91 @@ <h1 class="site-logo" id="site-title">INST126 Lecture Notes</h1>
3: Functions
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="4_Conditionals.html">
4: Conditionals
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="5_Lists.html">
5: Lists
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="6_Iteration.html">
6: Iteration
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="7_Strings.html">
7: Strings
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="8_Dictionaries.html">
8: Dictionaries
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="9_Files.html">
9: Files
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="10_Pandas-1.html">
10: Pandas for data analysis with Python: Part 1
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="11_Pandas-2.html">
11: Pandas for data analysis with Python: Part 2
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Problem-Formulation.html">
Problem Formulation
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Debugging-Helpseeking.html">
Debugging and Help-Seeking
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Help-Seeking-Template.html">
Help-Seeking Template
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="example-course-copier.html">
Sample program(s): course code filtering
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Conditionals.html">
Practice: Conditionals
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Module-2_Lists.html">
Practice: Lists
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Module-1-Projects.html">
Practice: Module 1 Project (Conditional Functions)
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Module-2-Projects.html">
Practice: Module 2 Project (Lists, Iteration, Strings)
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="Practice_Debugging_examples.html">
Practice: Debugging
</a>
</li>
</ul>

</div>
Expand Down Expand Up @@ -1293,7 +1373,7 @@ <h3>Mismatching arguments and parameters<a class="headerlink" href="#mismatching
<div class="cell_output docutils container">
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
<span class="ne">TypeError</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
<span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">folders</span><span class="o">/</span><span class="n">xz</span><span class="o">/</span><span class="n">_hjc5hsx743dclmg8n5678nc0000gn</span><span class="o">/</span><span class="n">T</span><span class="o">/</span><span class="n">ipykernel_60966</span><span class="o">/</span><span class="mf">3405736382.</span><span class="n">py</span> <span class="ow">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
<span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">folders</span><span class="o">/</span><span class="n">xz</span><span class="o">/</span><span class="n">_hjc5hsx743dclmg8n5678nc0000gn</span><span class="o">/</span><span class="n">T</span><span class="o">/</span><span class="n">ipykernel_30836</span><span class="o">/</span><span class="mf">3405736382.</span><span class="n">py</span> <span class="ow">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
<span class="g g-Whitespace"> </span><span class="mi">4</span> <span class="k">return</span> <span class="n">result</span>
<span class="g g-Whitespace"> </span><span class="mi">5</span>
<span class="ne">----&gt; </span><span class="mi">6</span> <span class="n">minus</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
Expand Down Expand Up @@ -1345,10 +1425,10 @@ <h3>Mismatching arguments and parameters<a class="headerlink" href="#mismatching
<p class="prev-next-title">2b: Variables</p>
</div>
</a>
<a class='right-next' id="next-link" href="example-course-copier.html" title="next page">
<a class='right-next' id="next-link" href="4_Conditionals.html" title="next page">
<div class="prev-next-info">
<p class="prev-next-subtitle">next</p>
<p class="prev-next-title">Sample program(s): course code filtering</p>
<p class="prev-next-title">4: Conditionals</p>
</div>
<i class="fas fa-angle-right"></i>
</a>
Expand Down
Loading

0 comments on commit 4abdbc4

Please sign in to comment.