{"id":117648,"date":"2020-09-07T08:07:38","date_gmt":"2020-09-07T08:07:38","guid":{"rendered":"https:\/\/blog.finxter.com\/?p=12783"},"modified":"2020-09-07T08:07:38","modified_gmt":"2020-09-07T08:07:38","slug":"hello-world-a-python-one-liner-to-get-started-with-python-quickly","status":"publish","type":"post","link":"https:\/\/sickgaming.net\/blog\/2020\/09\/07\/hello-world-a-python-one-liner-to-get-started-with-python-quickly\/","title":{"rendered":"Hello World! A Python One-Liner to Get Started with Python Quickly"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" 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\/uploads\/2020\/06\/python-logo-master-v3-TM-squared-transparent-150x150.png 150w\" sizes=\"(max-width: 178px) 100vw, 178px\" \/><\/figure>\n<\/div>\n<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\">&#8220;hello world program&#8221;<\/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 &#8212; 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>\n<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>\n<h2>Run Your Hello World One-Liner in Your Browser Shell<\/h2>\n<p><strong>Step 1: <\/strong>Here&#8217;s an interactive browser-based shell:<\/p>\n<p> <iframe loading=\"lazy\" src=\"https:\/\/trinket.io\/embed\/python\/3efcbe93b7\" width=\"100%\" height=\"356\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" allowfullscreen><\/iframe> <\/p>\n<p>The shell runs any Python program in your browser. <\/p>\n<p><strong>Step 2<\/strong>: Type the print function in your browser shell with opening and closing parentheses that are initially empty:<\/p>\n<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>\n<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>\n<p><strong>Step 3<\/strong>: Pass the <code>'hello world'<\/code> string into the <code>print()<\/code> function between the parentheses.<\/p>\n<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>\n<p>Congratulations, your first hello world one-liner is ready! Now, there&#8217;s only one thing left: <\/p>\n<p><strong>Step 4<\/strong>: Run the hello world one-liner program by hitting the &#8220;Run&#8221; symbol <img decoding=\"async\" src=\"https:\/\/s.w.org\/images\/core\/emoji\/12.0.0-1\/72x72\/25b6.png\" alt=\"\u25b6\" class=\"wp-smiley\" style=\"height: 1em; max-height: 1em;\" \/>. <\/p>\n<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>\n<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>\n<p>Make sure that you see this output in your shell before you move on!<\/p>\n<h2>Install Python on Your Computer<\/h2>\n<p>Now, you know how to run your first program. If you want to start your first serious project though, you&#8217;ll need Python on your local machine.<\/p>\n<p>Follow these seven steps to install Python on your computer (Windows):<\/p>\n<ol>\n<li>Visit website <strong>\u201cPython Releases for Windows\u201d<\/strong>: <a rel=\"noreferrer noopener\" href=\"https:\/\/www.python.org\/downloads\/windows\/\" target=\"_blank\">https:\/\/www.python.org\/downloads\/windows\/<\/a><\/li>\n<li>Click link <strong>\u201cDownload Windows x86-64 executable installer\u201d<\/strong> under \u201cStable Releases\u201d header.<\/li>\n<li>A popup opens. Click <strong>\u201cSave File\u201d<\/strong>.<\/li>\n<li>Wait until the download completes and double <strong>click on the installer file<\/strong> to run it.<\/li>\n<li>Another popup appears. Select <strong>\u201cAdd Python to Path\u201d<\/strong> and click <strong>\u201cInstall Now\u201d<\/strong>.<\/li>\n<li>Wait until the <strong>installation completes<\/strong> \u201cSetup was successful\u201d.<\/li>\n<li>You can now use Python on your Windows computer: use the <strong>Windows Search for \u201cIDLE\u201d<\/strong> and open the standard Python editor to <strong>start coding<\/strong>.<\/li>\n<\/ol>\n<p>The steps are almost identical for MacOS and Linux, you can figure them out easily. In this video, I&#8217;ll guide you through the process in a step-by-step manner:<\/p>\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\">\n<div class=\"wp-block-embed__wrapper\">\n<div class=\"ast-oembed-container\"><iframe loading=\"lazy\" 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>\n<\/div>\n<\/figure>\n<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>\n<h2>Learn the Python Basics<\/h2>\n<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&#8217;s such a Python cheat sheet for you:<\/p>\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/blog.finxter.com\/subscribe\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" 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\/uploads\/2020\/07\/Finxter_WorldsMostDensePythonCheatSheet-225x300.jpg 225w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/a><\/figure>\n<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&#8217;s also 100% free). Check it out for continuous improvement in Python by reading a series of course email lessons I&#8217;ll send you into your INBOX. Free Python cheat sheets are included!<\/p>\n<p><a href=\"https:\/\/blog.finxter.com\/subscribe\/\" target=\"_blank\" rel=\"noreferrer noopener\" title=\"Subscribe\">*** Join FREE Python Cheat Sheet Email Academy ***<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The &#8220;hello world program&#8221; is used in programming languages to set up a minimal programming environment and execute the first trivial program 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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[857],"tags":[73,468,528],"class_list":["post-117648","post","type-post","status-publish","format-standard","hentry","category-python-tut","tag-programming","tag-python","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/117648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/comments?post=117648"}],"version-history":[{"count":0,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/117648\/revisions"}],"wp:attachment":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media?parent=117648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/categories?post=117648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/tags?post=117648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}