Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tut] Hello World! A Python One-Liner to Get Started with Python Quickly

#1
Hello World! A Python One-Liner to Get Started with Python Quickly

<div><div class="wp-block-image">
<figure class="aligncenter size-large"><img src="https://blog.finxter.com/wp-content/uploads/2020/06/python-logo-master-v3-TM-squared-transparent.png" alt="" class="wp-image-9980" srcset="https://blog.finxter.com/wp-content/uploads/2020/06/python-logo-master-v3-TM-squared-transparent.png 178w, https://blog.finxter.com/wp-content/uplo...50x150.png 150w" sizes="(max-width: 178px) 100vw, 178px" /></figure>
</div>
<p><em>The <a href="https://en.wikipedia.org/wiki/%22Hello,_World!%22_program" target="_blank" rel="noreferrer noopener" title="https://en.wikipedia.org/wiki/%22Hello,_World!%22_program">“hello world program”</a> is used in programming languages to set up a <strong>minimal programming environment</strong> and <strong>execute the first trivial program</strong> in it. It helps you get your environment going and take your first steps towards a more complicated program. This short tutorial will show you the fastest possible way to write your first hello world program — as a <a href="https://blog.finxter.com/python-one-line-x/" title="Python One Line X" target="_blank" rel="noreferrer noopener">Python one-liner</a>! </em></p>
<p>Before I show you how to install Python on your computer, follow the following steps to run your first Python <code>"hello world"</code> program in your browser!</p>
<h2>Run Your Hello World One-Liner in Your Browser Shell</h2>
<p><strong>Step 1: </strong>Here’s an interactive browser-based shell:</p>
<p> <iframe src="https://trinket.io/embed/python/3efcbe93b7" width="100%" height="356" frameborder="0" marginwidth="0" marginheight="0" allowfullscreen></iframe> </p>
<p>The shell runs any Python program in your browser. </p>
<p><strong>Step 2</strong>: Type the print function in your browser shell with opening and closing parentheses that are initially empty:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">print()</pre>
<p>The <code><a href="https://blog.finxter.com/the-separator-and-end-arguments-of-the-python-print-function/" title="Python Print Function [And Its SECRET Separator &amp; End Arguments]" target="_blank" rel="noreferrer noopener">print()</a></code> function takes a string and prints it to your shell. This way, you can generate outputs in your program. Think about it: a Python program is only a means to an end. It transform an input to an output. One way of creating an output is to print program values to the shell. In our hello world one-liner, the output is the textual data (=string) <code>'hello world'</code>. </p>
<p><strong>Step 3</strong>: Pass the <code>'hello world'</code> string into the <code>print()</code> function between the parentheses.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">print('hello world')</pre>
<p>Congratulations, your first hello world one-liner is ready! Now, there’s only one thing left: </p>
<p><strong>Step 4</strong>: Run the hello world one-liner program by hitting the “Run” symbol <img src="https://s.w.org/images/core/emoji/12.0.0-1/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" />. </p>
<p>Can you see the output generated by your program? When running your program in the interactive shell, the result should be the following output:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">hello world</pre>
<p>Make sure that you see this output in your shell before you move on!</p>
<h2>Install Python on Your Computer</h2>
<p>Now, you know how to run your first program. If you want to start your first serious project though, you’ll need Python on your local machine.</p>
<p>Follow these seven steps to install Python on your computer (Windows):</p>
<ol>
<li>Visit website <strong>“Python Releases for Windows”</strong>: <a rel="noreferrer noopener" href="https://www.python.org/downloads/windows/" target="_blank">https://www.python.org/downloads/windows/</a></li>
<li>Click link <strong>“Download Windows x86-64 executable installer”</strong> under “Stable Releases” header.</li>
<li>A popup opens. Click <strong>“Save File”</strong>.</li>
<li>Wait until the download completes and double <strong>click on the installer file</strong> to run it.</li>
<li>Another popup appears. Select <strong>“Add Python to Path”</strong> and click <strong>“Install Now”</strong>.</li>
<li>Wait until the <strong>installation completes</strong> “Setup was successful”.</li>
<li>You can now use Python on your Windows computer: use the <strong>Windows Search for “IDLE”</strong> and open the standard Python editor to <strong>start coding</strong>.</li>
</ol>
<p>The steps are almost identical for MacOS and Linux, you can figure them out easily. In this video, I’ll guide you through the process in a step-by-step manner:</p>
<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio">
<div class="wp-block-embed__wrapper">
<div class="ast-oembed-container"><iframe title="How to Install Python on Windows? [7 Easy Steps]" width="1400" height="788" src="https://www.youtube.com/embed/l63sHcLE9Xw?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
</div>
</figure>
<p><strong>Related Article</strong>: <a href="https://blog.finxter.com/install-python-win/" target="_blank" rel="noreferrer noopener" title="How to Install Python on Windows? [7 Easy Steps]">7 Steps to Set Up Python on Windows</a></p>
<h2>Learn the Python Basics</h2>
<p>An excellent way to start learning Python is through <a href="https://blog.finxter.com/collection-5-cheat-sheets-every-python-coder-must-own/" title="[Collection] 11 Python Cheat Sheets Every Python Coder Must Own" target="_blank" rel="noreferrer noopener">Python cheat sheets</a>. They focus on the relevant parts and introduce the most important concepts in the shortest possible time. Here’s such a Python cheat sheet for you:</p>
<figure class="wp-block-image size-large"><a href="https://blog.finxter.com/subscribe/" target="_blank" rel="noopener noreferrer"><img src="https://blog.finxter.com/wp-content/uploads/2020/07/Finxter_WorldsMostDensePythonCheatSheet.jpg" alt="Python Ultimate Cheat Sheet" class="wp-image-10723" srcset="https://blog.finxter.com/wp-content/uploads/2020/07/Finxter_WorldsMostDensePythonCheatSheet.jpg 720w, https://blog.finxter.com/wp-content/uplo...25x300.jpg 225w" sizes="(max-width: 720px) 100vw, 720px" /></a></figure>
<p> You can download this and more cheat sheets in my <a href="https://blog.finxter.com/subscribe/" title="Subscribe" target="_blank" rel="noreferrer noopener">interactive Python email course</a> (that’s also 100% free). Check it out for continuous improvement in Python by reading a series of course email lessons I’ll send you into your INBOX. Free Python cheat sheets are included!</p>
<p><a href="https://blog.finxter.com/subscribe/" target="_blank" rel="noreferrer noopener" title="Subscribe">*** Join FREE Python Cheat Sheet Email Academy ***</a></p>
</div>


https://www.sickgaming.net/blog/2020/09/...n-quickly/
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016