Sick Gaming
[Tut] 6 Easy Steps to Get Started with Python - Printable Version

+- Sick Gaming (https://www.sickgaming.net)
+-- Forum: Programming (https://www.sickgaming.net/forum-76.html)
+--- Forum: Python (https://www.sickgaming.net/forum-83.html)
+--- Thread: [Tut] 6 Easy Steps to Get Started with Python (/thread-97027.html)



[Tut] 6 Easy Steps to Get Started with Python - xSicKxBot - 09-03-2020

6 Easy Steps to Get Started with Python

<div><p><em>When <a href="https://en.wikipedia.org/wiki/Guido_van_Rossum" target="_blank" rel="noreferrer noopener" title="https://en.wikipedia.org/wiki/Guido_van_Rossum">Guido van Rossum</a> released the first viable <a href="https://blog.finxter.com/how-to-check-your-python-version/" target="_blank" rel="noreferrer noopener" title="How to Check Your Python Version? A Helpful Guide">Python version</a> 0.9.0 in 1991, he couldn’t have expected (by a long shot) that he was on the verge of creating the most influential programming language in the world. Python has a bright future: every new Python version adds new features to the programming language.</em></p>
<figure class="wp-block-video aligncenter"><video autoplay loop muted src="https://media.giphy.com/media/KAq5w47R9rmTuvWOWa/giphy.mp4"></video></figure>
<p><em>In this quickstart guide, you’ll learn how to set up Python on your computer and install the newest version. Because Python is constantly evolving, we keep this information as generalized as possible.</em></p>
<p><strong><em>So, h</em>ow to get started with Python? Let’s go over the steps one by one.</strong></p>
<h2>Step 1: Download Python</h2>
<p>First, please visit the <a href="https://www.python.org/downloads/" target="_blank" rel="noreferrer noopener" title="https://www.python.org/downloads/">official Python website</a> and download the latest Python version. The download manager should already propose the correct installer for your operating system because it receives this information through your browser accessing the site.</p>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img src="https://blog.finxter.com/wp-content/uploads/2020/09/image-5.png" alt="Python Download Website" class="wp-image-12607" srcset="https://blog.finxter.com/wp-content/uploads/2020/09/image-5.png 605w, https://blog.finxter.com/wp-content/uploads/2020/09/image-5-300x111.png 300w, https://blog.finxter.com/wp-content/uploads/2020/09/image-5-150x56.png 150w" sizes="(max-width: 605px) 100vw, 605px" /></figure>
</div>
<h2>Step 2: Install Python on Your Machine</h2>
<p>Second, run the installer on your computer. In most operating systems, there’s nothing more to it than double clicking the downloaded file.</p>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img src="https://blog.finxter.com/wp-content/uploads/2020/09/image-6.png" alt="" class="wp-image-12608" srcset="https://blog.finxter.com/wp-content/uploads/2020/09/image-6.png 605w, https://blog.finxter.com/wp-content/uploads/2020/09/image-6-300x195.png 300w, https://blog.finxter.com/wp-content/uploads/2020/09/image-6-150x98.png 150w" sizes="(max-width: 605px) 100vw, 605px" /></figure>
</div>
<h2>Step 3: Check Your Python Installation</h2>
<p>Third, check if your Python installation worked properly by running the following command in your command line or PowerShell (Windows), terminal (MacOS), or shell (Linux).</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="">$ python –version
Python 3.8.3</pre>
<p><em><strong>Related</strong>: You can find all about <a href="https://blog.finxter.com/how-to-check-your-python-version/" title="How to Check Your Python Version? A Helpful Guide" target="_blank" rel="noreferrer noopener">checking your Python version </a>on my detailed blog article. </em></p>
<p>Here’s a screenshot checking the Python version on my Windows machine:</p>
<figure class="wp-block-image size-large"><img src="https://blog.finxter.com/wp-content/uploads/2020/09/image-7.png" alt="" class="wp-image-12609" srcset="https://blog.finxter.com/wp-content/uploads/2020/09/image-7.png 605w, https://blog.finxter.com/wp-content/uploads/2020/09/image-7-300x42.png 300w, https://blog.finxter.com/wp-content/uploads/2020/09/image-7-150x21.png 150w" sizes="(max-width: 605px) 100vw, 605px" /></figure>
<p>Congratulations, you have installed Python on your computer! </p>
<h2>Step 4: Write Your First Hello World Program with IDLE</h2>
<p>You can start writing your own programs with the IDLE editor that’s built into your system. Just search the phrase ‘IDLE’ on your operating system and open the program:</p>
<figure class="wp-block-image size-large"><img src="https://blog.finxter.com/wp-content/uploads/2020/09/image-8.png" alt="" class="wp-image-12610" srcset="https://blog.finxter.com/wp-content/uploads/2020/09/image-8.png 605w, https://blog.finxter.com/wp-content/uploads/2020/09/image-8-300x164.png 300w, https://blog.finxter.com/wp-content/uploads/2020/09/image-8-150x82.png 150w" sizes="(max-width: 605px) 100vw, 605px" /></figure>
<p>To start your first own program, type the following command into your shell:</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>Python will interpret your command and print the desired words to your shell:</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>This mode of communicating back-and-forth with your Python interpreter is called <strong>“interactive mode”</strong>. It has the advantage of immediate feedback. However, the great things about programs is automation—writing a program once and running it again and again. </p>
<p><strong><em>For example, how to write a program that greets you by name every time you run it?</em></strong></p>
<h2>Step 5: Create Your First Python Module</h2>
<p>To allow you to write a program once, save it on your computer, and run it at any later point in time, Python comes with what you may call a <strong>“scripting mode”</strong>. In this mode, you write a Python script and store it in a file with the suffix <code>.py</code> such as <code>my_first_program.py</code>.</p>
<p>You can create such a file via the menu of your IDLE shell:</p>
<figure class="wp-block-image size-large"><img src="https://blog.finxter.com/wp-content/uploads/2020/09/image-9.png" alt="" class="wp-image-12611" srcset="https://blog.finxter.com/wp-content/uploads/2020/09/image-9.png 605w, https://blog.finxter.com/wp-content/uploads/2020/09/image-9-300x168.png 300w, https://blog.finxter.com/wp-content/uploads/2020/09/image-9-150x84.png 150w" sizes="(max-width: 605px) 100vw, 605px" /></figure>
<p>Click “New File” and copy&amp;paste the following code into your new file:</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="">name = input("What's your name? ")
print('hello ' + name)</pre>
<p>You’ll learn about the commands of the Python programming language in <a href="https://blog.finxter.com/subscribe/" target="_blank" rel="noreferrer noopener" title="Subscribe">my free email academy</a> (with cheat sheets). For now, please store your file under the name <code>'hello.py'</code> on your Desktop or any other location. Your current state should look like this:</p>
<figure class="wp-block-image size-large"><img src="https://blog.finxter.com/wp-content/uploads/2020/09/image-10.png" alt="" class="wp-image-12612" srcset="https://blog.finxter.com/wp-content/uploads/2020/09/image-10.png 605w, https://blog.finxter.com/wp-content/uploads/2020/09/image-10-300x69.png 300w, https://blog.finxter.com/wp-content/uploads/2020/09/image-10-150x35.png 150w" sizes="(max-width: 605px) 100vw, 605px" /></figure>
<p>You can test-run this program here in your browser in our interactive Python shell:</p>
<p> <iframe height="400px" width="100%" src="https://repl.it/@finxter/helloworld?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe> </p>
<p><em><strong>Exercise</strong>: Run the code and type in your name. What’s the output?</em></p>
<h2>Step 6: Run Your First Module</h2>
<p>Now, let’s get some action going: Click <code>Run > Run Module</code>. The Python program start executing in the interactive shell—but without you needing to type each line into it. It runs through the code file line by line. The first line asks you to put in your name. Type it in. The second line then takes your name and prints it to the shell. Here’s how this looks in my case:</p>
<figure class="wp-block-image size-large"><img src="https://blog.finxter.com/wp-content/uploads/2020/09/image-11.png" alt="" class="wp-image-12613" srcset="https://blog.finxter.com/wp-content/uploads/2020/09/image-11.png 605w, https://blog.finxter.com/wp-content/uploads/2020/09/image-11-300x42.png 300w, https://blog.finxter.com/wp-content/uploads/2020/09/image-11-150x21.png 150w" sizes="(max-width: 605px) 100vw, 605px" /></figure>
<h2>Conclusion</h2>
<p>Believe it or not, this procedure will later allow you to run your own <a href="https://blog.finxter.com/how-real-freelancers-earn-money-in-2019-10-practical-python-projects/" target="_blank" rel="noreferrer noopener" title="How Real Freelancers Earn Money in 2020: 10 Practical Python Projects">applications</a>. Although the applications will get more complicated, the basic process looks the same: First, you create a Python file that contains the application. Second, you run the application on your computer. Theoretically, you don’t need any other <a href="https://blog.finxter.com/best-python-ide/" title="Best Python IDE and Code Editors [Ultimate Guide]">Python editor</a> – the preinstalled IDLE editor is all you need!</p>
<p>While this is already a great accomplishment for the day, most coders don’t use the built-in Python editor IDLE a lot. Why? Because it’s harder with the IDLE editor to write simple programs and the editor doesn’t provide you with advanced tools, assistance, and language support. Instead, a far better option for most coders will be to install an integrated development environment (IDE). One of the most popular for Python is PyCharm.</p>
<p>However, this is an optional step and different coders prefer different development environments. <a href="https://www.jetbrains.com/pycharm/download/" target="_blank" rel="noreferrer noopener" title="https://www.jetbrains.com/pycharm/download/">You can find detailed installation and setup guides online.</a> We recommend you follow these instructions to set up your own PyCharm projects. Even if this takes you an hour or so to complete, it’s a good investment in your future productivity!</p>
<h2>Where to Go From Here?</h2>
<p>Enough theory, let’s get some practice!</p>
<p>To become successful in coding, you need to get out there and solve real problems for real people. That’s how you can become a six-figure earner easily. And that’s how you polish the skills you really need in practice. After all, what’s the use of learning theory that nobody ever needs?</p>
<p><strong>Practice projects is how you sharpen your saw in coding!</strong></p>
<p>Do you want to become a code master by focusing on practical code projects that actually earn you money and solve problems for people?</p>
<p>Then become a Python freelance developer! It’s the best way of approaching the task of improving your Python skills—even if you are a complete beginner.</p>
<p>Join my free webinar <a rel="noreferrer noopener" href="https://blog.finxter.com/webinar-freelancer/" target="_blank">“How to Build Your High-Income Skill Python”</a> and watch how I grew my coding business online and how you can, too—from the comfort of your own home.</p>
<p><a href="https://blog.finxter.com/webinar-freelancer/" target="_blank" rel="noreferrer noopener">Join the free webinar now!</a></p>
</div>


https://www.sickgaming.net/blog/2020/09/03/6-easy-steps-to-get-started-with-python/