<?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 Groundhog Learning</title><link>https://groundhoglearning.com/vault/programming/python/</link><description>Recent content in Python on Groundhog Learning</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://groundhoglearning.com/vault/programming/python/index.xml" rel="self" type="application/rss+xml"/><item><title>Comment (Python)</title><link>https://groundhoglearning.com/vault/programming/python/comment/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://groundhoglearning.com/vault/programming/python/comment/</guid><description>&lt;h2 id="single-line-comment"&gt;Single Line Comment&lt;a class="anchor" href="#single-line-comment"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A single line comment starts with &lt;code&gt;#&lt;/code&gt; and continues until the end of the line.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Everything on this line is commented.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;print(&lt;span style="color:#e6db74"&gt;&amp;#34;Hello, World!&amp;#34;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can also write it inline, to the right of your code:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;print(&lt;span style="color:#e6db74"&gt;&amp;#34;Hello, World!&amp;#34;&lt;/span&gt;) &lt;span style="color:#75715e"&gt;# Everything to the right is commented.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="multi-line-comments"&gt;Multi-Line Comments&lt;a class="anchor" href="#multi-line-comments"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python does not have a dedicated block comment syntax. Instead, you write multiple single line comments:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# This is a comment&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# that spans multiple&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# lines&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;print(&lt;span style="color:#e6db74"&gt;&amp;#34;Hello, World!&amp;#34;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="backlinks"&gt;Backlinks&lt;a class="anchor" href="#backlinks"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="../../comment"class="book-link book-link--internal"&gt;
 Comment&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Declare a Variable in Python</title><link>https://groundhoglearning.com/vault/programming/python/declare-variable/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://groundhoglearning.com/vault/programming/python/declare-variable/</guid><description>&lt;p&gt;In Python, you declare a variable by writing the &lt;strong&gt;name&lt;/strong&gt;, followed by &lt;code&gt;=&lt;/code&gt; and the &lt;strong&gt;value&lt;/strong&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;score &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;score&lt;/code&gt; — the name you use to refer to this variable&lt;/li&gt;
&lt;li&gt;&lt;code&gt;0&lt;/code&gt; — the initial value assigned to it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There is no need to specify a type. Python figures out the type from the value on the right.&lt;/p&gt;
&lt;h2 id="naming-rules"&gt;Naming Rules&lt;a class="anchor" href="#naming-rules"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Names can contain letters, digits, and underscores.&lt;/li&gt;
&lt;li&gt;Names cannot start with a digit.&lt;/li&gt;
&lt;li&gt;Names are case-sensitive: &lt;code&gt;choice&lt;/code&gt; and &lt;code&gt;Choice&lt;/code&gt; are different variables.&lt;/li&gt;
&lt;li&gt;Use clear, descriptive names that reflect the value being stored.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="resources"&gt;Resources&lt;a class="anchor" href="#resources"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.python.org/3/reference/simple_stmts.html#assignment-statements"class="book-link book-link--external" target="_blank" rel="noopener noreferrer" &gt;
 Variables (Python docs)&lt;span class="book-link__icon" aria-hidden="true"&gt;↗&lt;/span&gt;
 &lt;span class="sr-only"&gt;(external link)&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="backlinks"&gt;Backlinks&lt;a class="anchor" href="#backlinks"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="../../variable"class="book-link book-link--internal"&gt;
 Variable&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>