Free AI web copilot to create summaries, insights and extended knowledge, download it at here
663
Abstract
“))
<span class="hljs-keyword">if</span> <span class="hljs-keyword">x</span> % <span class="hljs-number">2</span> == <span class="hljs-number">1</span>:
<span class="hljs-keyword">print</span> (<span class="hljs-keyword">x</span>,” <span class="hljs-keyword">is</span> odd”)
<span class="hljs-keyword">else</span>:
<span class="hljs-keyword">print</span> (<span class="hljs-keyword">x</span>,” <span class="hljs-keyword">is</span> even”)</pre></div><p id="ef30">The prompt “give me a number” is printed on the screen.</p><p id="4425">The input command returns<a href="https://readmedium.com/2-2-22-ebb4f648fcd"> a string.</a></p><p id="6a81">The int co
Options
mmand turns the string into an integer.</p><p id="89b4">If you divide this number or integer by 2</p><p id="c722">the modulo operator will return the remainder</p><p id="4d3f">which will be either 0 or 1</p><p id="bfc6">If it is equal to 1 then the number is odd.</p><p id="7ada">If it is equal to 0 then the number is even.</p><p id="d8b6">This story is published in <a href="https://medium.com/afwp?source=post_page---------------------------">a Few Words</a>, Medium’s publication that only accepts stories under 500 words.</p><h2 id="0259">If you have a few meaningful words to say and want to be a writer in our publication, visit here.</h2></article></body>